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
This commit is contained in:
parent
a753df11b8
commit
ec856f5f8b
@ -1,3 +1,10 @@
|
||||
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.
|
||||
|
@ -20258,7 +20258,9 @@ cp_parser_cv_qualifier_seq_opt (cp_parser* parser)
|
||||
|
||||
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
|
||||
@ -20405,7 +20407,9 @@ cp_parser_virt_specifier_seq_opt (cp_parser* parser)
|
||||
|
||||
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
|
||||
@ -27677,7 +27681,11 @@ set_and_check_decl_spec_loc (cp_decl_specifier_seq *decl_specs,
|
||||
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
|
||||
{
|
||||
@ -27698,8 +27706,9 @@ set_and_check_decl_spec_loc (cp_decl_specifier_seq *decl_specs,
|
||||
"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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
29
gcc/testsuite/g++.dg/cpp0x/duplicate1.C
Normal file
29
gcc/testsuite/g++.dg/cpp0x/duplicate1.C
Normal file
@ -0,0 +1,29 @@
|
||||
// { 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 "" } */
|
18
gcc/testsuite/g++.dg/diagnostic/duplicate1.C
Normal file
18
gcc/testsuite/g++.dg/diagnostic/duplicate1.C
Normal file
@ -0,0 +1,18 @@
|
||||
// { 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 "" } */
|
Loading…
x
Reference in New Issue
Block a user