@@ -23123,7 +23123,11 @@ cp_parser_member_declaration (cp_parser* parser)
{
cp_token *token = cp_lexer_peek_token (parser->lexer);
if (!in_system_header_at (token->location))
- pedwarn (token->location, OPT_Wpedantic, "extra %<;%>");
+ {
+ gcc_rich_location richloc (token->location);
+ richloc.add_fixit_remove ();
+ pedwarn_at_rich_loc (&richloc, OPT_Wpedantic, "extra %<;%>");
+ }
}
else
{
new file mode 100644
@@ -0,0 +1,17 @@
+/* { dg-options "-fdiagnostics-show-caret -Wpedantic" } */
+
+/* Struct with extra semicolon. */
+struct s1 { int i;; }; /* { dg-warning "19: extra .;." } */
+/* { dg-begin-multiline-output "" }
+ struct s1 { int i;; };
+ ^
+ -
+ { dg-end-multiline-output "" } */
+
+/* Union with extra semicolon. */
+union u1 { int i;; }; /* { dg-warning "18: extra .;." } */
+/* { dg-begin-multiline-output "" }
+ union u1 { int i;; };
+ ^
+ -
+ { dg-end-multiline-output "" } */