+2017-04-24 Volker Reichelt <v.reichelt@netcologne.de>
+
+ * parser.c (cp_parser_cv_qualifier_seq_opt): Add fix-it info to
+ error message.
+ (cp_parser_virt_specifier_seq_opt): Likewise.
+ (set_and_check_decl_spec_loc): Likewise twice.
+
2017-04-21 Jason Merrill <jason@redhat.com>
PR c++/80179 - ICE with initialized flexible array member.
if (cv_quals & cv_qualifier)
{
- error_at (token->location, "duplicate cv-qualifier");
+ gcc_rich_location richloc (token->location);
+ richloc.add_fixit_remove ();
+ error_at_rich_loc (&richloc, "duplicate cv-qualifier");
cp_lexer_purge_token (parser->lexer);
}
else
if (virt_specifiers & virt_specifier)
{
- error_at (token->location, "duplicate virt-specifier");
+ gcc_rich_location richloc (token->location);
+ richloc.add_fixit_remove ();
+ error_at_rich_loc (&richloc, "duplicate virt-specifier");
cp_lexer_purge_token (parser->lexer);
}
else
error_at (location,
"both %<__thread%> and %<thread_local%> specified");
else
- error_at (location, "duplicate %qD", token->u.value);
+ {
+ gcc_rich_location richloc (location);
+ richloc.add_fixit_remove ();
+ error_at_rich_loc (&richloc, "duplicate %qD", token->u.value);
+ }
}
else
{
"constexpr",
"__complex"
};
- error_at (location,
- "duplicate %qs", decl_spec_names[ds]);
+ gcc_rich_location richloc (location);
+ richloc.add_fixit_remove ();
+ error_at_rich_loc (&richloc, "duplicate %qs", decl_spec_names[ds]);
}
}
}
+2017-04-24 Volker Reichelt <v.reichelt@netcologne.de>
+
+ * g++.dg/diagnostic/duplicate1.C: New test.
+ * g++.dg/cpp0x/duplicate1.C: New test.
+
2017-04-24 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/80293
--- /dev/null
+// { dg-options "-fdiagnostics-show-caret" }
+// { dg-do compile { target c++11 } }
+
+struct A
+{
+ virtual void foo() const;
+};
+
+struct B final final : A /* { dg-error "duplicate virt-specifier" }
+ { dg-begin-multiline-output "" }
+ struct B final final : A
+ ^~~~~
+ -----
+ { dg-end-multiline-output "" } */
+{
+ virtual void foo() const override final override; /* { dg-error "duplicate virt-specifier" }
+ { dg-begin-multiline-output "" }
+ virtual void foo() const override final override;
+ ^~~~~~~~
+ --------
+ { dg-end-multiline-output "" } */
+};
+
+thread_local thread_local int i = 0; /* { dg-error "duplicate" }
+ { dg-begin-multiline-output "" }
+ thread_local thread_local int i = 0;
+ ^~~~~~~~~~~~
+ ------------
+ { dg-end-multiline-output "" } */
--- /dev/null
+// { dg-options "-fdiagnostics-show-caret" }
+
+struct A
+{
+ void foo() const const; /* { dg-error "duplicate cv-qualifier" }
+ { dg-begin-multiline-output "" }
+ void foo() const const;
+ ^~~~~
+ -----
+ { dg-end-multiline-output "" } */
+};
+
+volatile volatile int i = 0; /* { dg-error "duplicate" }
+ { dg-begin-multiline-output "" }
+ volatile volatile int i = 0;
+ ^~~~~~~~
+ --------
+ { dg-end-multiline-output "" } */