Commit 79cd6c7b by Paolo Carlini Committed by Paolo Carlini

parser.c (cp_parser_class_head): Improve error recovery upon extra qualification error.

/cp
2019-10-21  Paolo Carlini  <paolo.carlini@oracle.com>

	* parser.c (cp_parser_class_head): Improve error recovery upon
	extra qualification error.

/testsuite
2019-10-21  Paolo Carlini  <paolo.carlini@oracle.com>

	* g++.dg/parse/qualified2.C: Tighten dg-error directive.
	* g++.old-deja/g++.other/decl5.C: Don't expect redundant error.

From-SVN: r277268
parent 5b884e94
2019-10-21 Paolo Carlini <paolo.carlini@oracle.com>
* parser.c (cp_parser_class_head): Improve error recovery upon
extra qualification error.
2019-10-21 Jakub Jelinek <jakub@redhat.com> 2019-10-21 Jakub Jelinek <jakub@redhat.com>
PR c++/92015 PR c++/92015
......
...@@ -24178,12 +24178,8 @@ cp_parser_class_head (cp_parser* parser, ...@@ -24178,12 +24178,8 @@ cp_parser_class_head (cp_parser* parser,
... [or] the definition or explicit instantiation of a ... [or] the definition or explicit instantiation of a
class member of a namespace outside of its namespace. */ class member of a namespace outside of its namespace. */
if (scope == nested_name_specifier) if (scope == nested_name_specifier)
{ permerror (nested_name_specifier_token_start->location,
permerror (nested_name_specifier_token_start->location, "extra qualification not allowed");
"extra qualification not allowed");
nested_name_specifier = NULL_TREE;
num_templates = 0;
}
} }
/* An explicit-specialization must be preceded by "template <>". If /* An explicit-specialization must be preceded by "template <>". If
it is not, try to recover gracefully. */ it is not, try to recover gracefully. */
2019-10-21 Paolo Carlini <paolo.carlini@oracle.com>
* g++.dg/parse/qualified2.C: Tighten dg-error directive.
* g++.old-deja/g++.other/decl5.C: Don't expect redundant error.
2019-10-21 Jakub Jelinek <jakub@redhat.com> 2019-10-21 Jakub Jelinek <jakub@redhat.com>
PR c++/92015 PR c++/92015
......
namespace Glib { namespace Glib {
template <typename> class Value {}; template <typename> class Value {};
template <> class Glib::Value<int> {}; // { dg-error "" } template <> class Glib::Value<int> {}; // { dg-error "29:extra qualification" }
} }
...@@ -8,11 +8,10 @@ ...@@ -8,11 +8,10 @@
struct A { struct A {
int A::fn(); // { dg-error "extra qualification" } int A::fn(); // { dg-error "7:extra qualification" }
int A::m; // { dg-error "extra qualification" } int A::m; // { dg-error "7:extra qualification" }
struct e; struct e;
struct A::e {int i;}; // { dg-error "extra qualification" "qual" } struct A::e {int i;}; // { dg-error "10:extra qualification" "qual" }
// { dg-error "anonymous struct" "anon" { target *-*-* } .-1 }
struct A::expand { // { dg-error "qualified name" } struct A::expand { // { dg-error "qualified name" }
int m; int m;
}; };
......
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