struct Solvable; namespace sat { class Solvable { public: typedef bool bool_type; }; } class Resolvable : public sat::Solvable { public: using sat::Solvable::bool_type; }; when compiled with -std=c++0x is rejected with T.cc:14:28: error: type 'Solvable' is not a base type for type 'Resolvable' It works when using using Solvable::bool_type and when using ::sat::Solvable::bool_type and it works without -std=c++0x
The following is rejected as well, with the same error struct Solvable; namespace sat { class Solvable { public: typedef bool bool_type; }; } namespace sat2 { class Solvable { public: typedef bool bool_type; }; } class Resolvable : public sat::Solvable, sat2::Solvable { public: using Solvable::bool_type; }; only qualifying with ::sat[2]::Solvable::bool_type works.
Fabien, could you take a look at this one too?
I'm busy this week, but I will look into it next week.
I can confirm the issue. Run into the problem when re-compiling a project with C++11. Works fine in C++98/03, does not compile in C++11. Both work-arounds suggested in the first comment works.
Ping?
(In reply to comment #5) > Ping? I haven't yet finished the investigation. Something is broken in c++11 mode, the parsing of Solvable in "using sat::Solvable::bool_type;" is failing in c++11 mode, debug_tree() is crashing while debugging it.
Created attachment 27180 [details] return earlier in cp_parser_alias_declaration
It is related to alias declarations. It seems that we do not recover properly from a failure in cp_parser_alias_declaration, in the block introduced by this check: "if (!(flags & CP_PARSER_FLAGS_NO_USER_DEFINED_TYPES))", around here: #0 cp_parser_simple_type_specifier (parser=0x7ffff571b738, decl_specs=0x7fffffffdd00, flags=1) at ../../gcc/gcc/cp/parser.c:13651 #1 0x00000000006be5e0 in cp_parser_type_specifier (parser=0x7ffff571b738, flags=1, decl_specs=0x7fffffffdd00, is_declaration=0 '\000', declares_class_or_enum=0x0, is_cv_qualifier=0x7fffffffdcde "") at ../../gcc/gcc/cp/parser.c:13434 #2 0x00000000006c5c96 in cp_parser_type_specifier_seq (parser=0x7ffff571b738, is_declaration=0 '\000', is_trailing_return=0 '\000', type_specifier_seq=0x7fffffffdd00) at ../../gcc/gcc/cp/parser.c:16887 #3 0x00000000006c5a63 in cp_parser_type_id_1 (parser=0x7ffff571b738, is_template_arg=0 '\000', is_trailing_return=0 '\000') at ../../gcc/gcc/cp/parser.c:16771 #4 0x00000000006c5b57 in cp_parser_type_id (parser=0x7ffff571b738) at ../../gcc/gcc/cp/parser.c:16810 #5 0x00000000006c1987 in cp_parser_alias_declaration (parser=0x7ffff571b738) at ../../gcc/gcc/cp/parser.c:15101 I can't find what goes wrong there. The good news is that it seems to work if we return earlier in cp_parser_alias_declaration -- which I think is better --, like in the attached patch. Perhaps Dodji (or Jason) can take a closer look ?
I no longer work on it, so it is more honest to set this bug as unassigned. The patch I attached here fixes the problem, because it bypasses a deeper issues. Returning the earliest possible in cp_parser_alias_declaration makes sense to me because there are probably much more using-declarations than alias-declarations to parse at the moment. However, I do not want to submit it because I think we should fix the real issue as well. I had a look on non-matching parse_tentatively/definitely, without finding anything suspect. If one needs some details about what goes wrong -- if I was unclear here and in previous comments --, do not hesitate to ask me.
then it should really be status=NEW, you're not waiting for details from the reporter
*** Bug 53247 has been marked as a duplicate of this bug. ***
*** Bug 53368 has been marked as a duplicate of this bug. ***
This is triggered by revision 181118: http://gcc.gnu.org/ml/gcc-cvs/2011-11/msg00406.html
I've got another small reproducer, that shows up as a slightly different failure, but very likely is the same problem: namespace util { } // comment out => problem disappears namespace foo { namespace util { struct Printer { struct Convert { }; }; class XPrinter: Printer { // using ::foo::util::Printer::Convert; // ok // using Printer::Convert; // ok using foo::util::Printer::Convert; // error }; } } g++ --version g++ (GCC) 4.8.0 20120515 (experimental) g++ -c pp.ii -std=c++11 pp.ii:13:24: error: ‘util::Printer’ has not been declared using foo::util::Printer::Convert; // error g++ -c pp.ii -std=c++98 && echo ok ok
Author: rguenth Date: Wed Jun 6 12:22:16 2012 New Revision: 188264 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188264 Log: 2012-06-06 Fabien Chene <fabien@gcc.gnu.org> PR c++/52841 * parser.c (cp_parser_alias_declaration): Return earlier if an error occured. * g++.dg/cpp0x/pr52841.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp0x/pr52841.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
Fixed for trunk for now.
GCC 4.7.1 is being released, adjusting target milestone.
Author: rguenth Date: Thu Jun 14 12:55:11 2012 New Revision: 188613 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188613 Log: 2012-06-14 Richard Guenther <rguenther@suse.de> Backport from mainline 2012-06-06 Fabien Chene <fabien@gcc.gnu.org> PR c++/52841 * parser.c (cp_parser_alias_declaration): Return earlier if an error occured. * g++.dg/cpp0x/pr52841.C: New testcase. Added: branches/gcc-4_7-branch/gcc/testsuite/g++.dg/cpp0x/pr52841.C Modified: branches/gcc-4_7-branch/gcc/cp/ChangeLog branches/gcc-4_7-branch/gcc/cp/parser.c branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
Fixed.