This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ Patch] PR 37087
Hi,
I guess I think we should try to leave the permerror in place, unless
there's a fundamental reason we can't make it work, and add a test
(with -fpermissive) for this to the testsuite so that we keep it working.
Ok, thanks for your feedback.
My point, inspired by this PR of course, was essentially that every time
we have a permerror we don't know if an error occurs or not, I would say
the front-end becomes a tad more complex, because must tolerate rather
special situations (so special that are errors by default) and proceed
anyway.
By the way, I tested alternate fixes for this issue, which just detects
the problem with ::a in the parser, thus much earlier. In this case the
error message doesn't mention anymore specializations... I'm attaching a
draft here, FYI
Thanks,
Paolo.
/////////////////
Index: testsuite/g++.dg/template/crash80.C
===================================================================
*** testsuite/g++.dg/template/crash80.C (revision 0)
--- testsuite/g++.dg/template/crash80.C (revision 0)
***************
*** 0 ****
--- 1,9 ----
+ // PR c++/37087
+
+ namespace a {
+ template <typename T> class Foo;
+ }
+
+ namespace b {
+ template <> class ::a::Foo<double> {}; // { dg-error "global qualification" }
+ }
Index: cp/parser.c
===================================================================
*** cp/parser.c (revision 138953)
--- cp/parser.c (working copy)
*************** cp_parser_class_head (cp_parser* parser,
*** 14981,14988 ****
cp_parser_commit_to_tentative_parse (parser);
/* Issue the error about the overly-qualified name now. */
if (qualified_p)
! cp_parser_error (parser,
! "global qualification of class name is invalid");
else if (invalid_nested_name_p)
cp_parser_error (parser,
"qualified name does not name a class");
--- 14981,14991 ----
cp_parser_commit_to_tentative_parse (parser);
/* Issue the error about the overly-qualified name now. */
if (qualified_p)
! {
! cp_parser_error (parser,
! "global qualification of class name is invalid");
! return error_mark_node;
! }
else if (invalid_nested_name_p)
cp_parser_error (parser,
"qualified name does not name a class");