Commit ec856f5f by Volker Reichelt Committed by Volker Reichelt

parser.c (cp_parser_cv_qualifier_seq_opt): Add fix-it info to error message.

        * 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.

        * g++.dg/diagnostic/duplicate1.C: New test.
        * g++.dg/cpp0x/duplicate1.C: New test.

From-SVN: r247105
parent a753df11
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> 2017-04-21 Jason Merrill <jason@redhat.com>
PR c++/80179 - ICE with initialized flexible array member. PR c++/80179 - ICE with initialized flexible array member.
......
...@@ -20258,7 +20258,9 @@ cp_parser_cv_qualifier_seq_opt (cp_parser* parser) ...@@ -20258,7 +20258,9 @@ cp_parser_cv_qualifier_seq_opt (cp_parser* parser)
if (cv_quals & cv_qualifier) 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); cp_lexer_purge_token (parser->lexer);
} }
else else
...@@ -20405,7 +20407,9 @@ cp_parser_virt_specifier_seq_opt (cp_parser* parser) ...@@ -20405,7 +20407,9 @@ cp_parser_virt_specifier_seq_opt (cp_parser* parser)
if (virt_specifiers & virt_specifier) 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); cp_lexer_purge_token (parser->lexer);
} }
else else
...@@ -27677,7 +27681,11 @@ set_and_check_decl_spec_loc (cp_decl_specifier_seq *decl_specs, ...@@ -27677,7 +27681,11 @@ set_and_check_decl_spec_loc (cp_decl_specifier_seq *decl_specs,
error_at (location, error_at (location,
"both %<__thread%> and %<thread_local%> specified"); "both %<__thread%> and %<thread_local%> specified");
else 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 else
{ {
...@@ -27698,8 +27706,9 @@ set_and_check_decl_spec_loc (cp_decl_specifier_seq *decl_specs, ...@@ -27698,8 +27706,9 @@ set_and_check_decl_spec_loc (cp_decl_specifier_seq *decl_specs,
"constexpr", "constexpr",
"__complex" "__complex"
}; };
error_at (location, gcc_rich_location richloc (location);
"duplicate %qs", decl_spec_names[ds]); 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> 2017-04-24 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/80293 PR tree-optimization/80293
......
// { 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 "" } */
// { 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 "" } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment