===================================================================
@@ -504,6 +504,10 @@
C ObjC C++ ObjC++ Warning
; in common.opt
+Wextra-semi
+C++ Var(warn_extra_semi) Warning
+Warn about semicolon after in-class function definition.
+
Wfloat-conversion
C ObjC C++ ObjC++ Var(warn_float_conversion) Warning LangEnabledBy(C ObjC C++ ObjC++,Wconversion)
Warn for implicit type conversions that cause loss of floating point precision.
2017-04-07 Volker Reichelt <v.reichelt@netcologne.de>
* parser.c (cp_parser_member_declaration): Add warning for
extra semicolon after in-class function definition.
===================================================================
@@ -23386,7 +23386,11 @@
token = cp_lexer_peek_token (parser->lexer);
/* If the next token is a semicolon, consume it. */
if (token->type == CPP_SEMICOLON)
- cp_lexer_consume_token (parser->lexer);
+ {
+ cp_lexer_consume_token (parser->lexer);
+ warning (OPT_Wextra_semi, "extra %<;%> "
+ "after in-class function definition");
+ }
goto out;
}
else
2017-04-07 Volker Reichelt <v.reichelt@netcologne.de>
* g++.dg/warn/Wextra-semi.C: New test.
===================================================================
@@ -0,0 +1,8 @@
+// { dg-options "-Wextra-semi" }
+
+struct A
+{
+ A() {}; // { dg-warning "after in-class function definition" }
+ void foo() {}; // { dg-warning "after in-class function definition" }
+ friend void bar() {}; // { dg-warning "after in-class function definition" }
+};