The following code sample does not compile, and it should. I get the error: error: 'o_t' is not a class or namespace G++ version: g++ (GCC) 4.4.0 20080729 (experimental) template<class X> class O{ public: typedef X type_t; }; template<class X> class A{ public: typedef O<X> o_t; }; template<class X> class B: A<X>{ public: using typename A<X>::o_t; B(){typename o_t::type_t x;} }; int main(int argc, char *argv[]){ B<int> b; return 1; }
Sorry, full error is gpp_bug_2.cpp: In constructor `B<X>::B()': gpp_bug_2.cpp:15: error: `o_t' is not a class or namesp gpp_bug_2.cpp:15: error: `type_t' does not name a type
With the test case, I get the same diagnostic with g++-4.3.2. I'm not sure if the in-class using directive is supposed to work as you expected, but what I usually write is (using your example): template<class X> class B: A<X>{ public: typedef typename A<X>::o_t o_t; B(){typename o_t::type_t x;} }; ... which compiles for me.
is this bug 14258 ?
PR14258 is fixed and this is still rejected. Maybe Fabien wants to have a look?!?
(In reply to Paolo Carlini from comment #4) > PR14258 is fixed and this is still rejected. Maybe Fabien wants to have a > look?!? Sure, I'll have a look. Thank you Paolo!
Thanks a lot!
Any news on this?
(In reply to Paolo Carlini from comment #7) > Any news on this? Sorry Paolo, no news. I will look into it after I resurrect some "stage one 1 material" patches on using decls (comming after c++/54537). I think this one can be tackled in stage 3.
Fabien, any news on this - now that we are in Stage 3?
(In reply to Paolo Carlini from comment #9) > Fabien, any news on this - now that we are in Stage 3? I have successfuly tested a patch, but wait a moment, I need to refine it a bit.
Author: fabien Date: Sun Feb 2 19:58:06 2014 New Revision: 207407 URL: http://gcc.gnu.org/viewcvs?rev=207407&root=gcc&view=rev Log: 2014-02-02 Fabien Chene <fabien@gcc.gnu.org> PR c++/37140 * parser.c (cp_parser_nonclass_name): Call strip_using_decl and move the code handling dependent USING_DECLs... * name-lookup.c (strip_using_decl): ...Here. 2014-02-02 Fabien Chene <fabien@gcc.gnu.org> PR c++/37140 * g++.dg/template/using27.C: New. * g++.dg/template/using28.C: New. * g++.dg/template/using29.C: New. Modified: trunk/gcc/cp/name-lookup.c
Author: fabien Date: Sun Feb 2 20:02:37 2014 New Revision: 207408 URL: http://gcc.gnu.org/viewcvs?rev=207408&root=gcc&view=rev Log: 2014-02-02 Fabien Chene <fabien@gcc.gnu.org> PR c++/37140 * parser.c (cp_parser_nonclass_name): Call strip_using_decl and move the code handling dependent USING_DECLs... * name-lookup.c (strip_using_decl): ...Here. 2014-02-02 Fabien Chene <fabien@gcc.gnu.org> PR c++/37140 * g++.dg/template/using27.C: New. * g++.dg/template/using28.C: New. * g++.dg/template/using29.C: New. Added: trunk/gcc/testsuite/g++.dg/template/using27.C trunk/gcc/testsuite/g++.dg/template/using28.C trunk/gcc/testsuite/g++.dg/template/using29.C Modified: trunk/gcc/cp/parser.c
Fixed in 4.9. I will backport it to 4.8 and 4.7 if everething goes well.
*** Bug 58047 has been marked as a duplicate of this bug. ***
Author: fabien Date: Mon Feb 24 20:27:34 2014 New Revision: 208093 URL: http://gcc.gnu.org/viewcvs?rev=208093&root=gcc&view=rev Log: 2014-02-24 Fabien Chene <fabien@gcc.gnu.org> PR c++/37140 * parser.c (cp_parser_nonclass_name): Call strip_using_decl and move the code handling dependent USING_DECLs... * name-lookup.c (strip_using_decl): ...Here. 2014-02-24 Fabien Chene <fabien@gcc.gnu.org> PR c++/37140 * g++.dg/template/using27.C: New. * g++.dg/template/using28.C: New. * g++.dg/template/using29.C: New. Added: branches/gcc-4_8-branch/gcc/testsuite/g++.dg/template/using27.C branches/gcc-4_8-branch/gcc/testsuite/g++.dg/template/using28.C branches/gcc-4_8-branch/gcc/testsuite/g++.dg/template/using29.C Modified: branches/gcc-4_8-branch/gcc/cp/ChangeLog branches/gcc-4_8-branch/gcc/cp/name-lookup.c branches/gcc-4_8-branch/gcc/cp/parser.c branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
Author: fabien Date: Wed Feb 26 21:16:15 2014 New Revision: 208182 URL: http://gcc.gnu.org/viewcvs?rev=208182&root=gcc&view=rev Log: 2014-02-26 Fabien Chene <fabien@gcc.gnu.org> PR c++/37140 * parser.c (cp_parser_nonclass_name): Call strip_using_decl and move the code handling dependent USING_DECLs... * name-lookup.c (strip_using_decl): ...Here. 2014-02-26 Fabien Chene <fabien@gcc.gnu.org> PR c++/37140 * g++.dg/template/using27.C: New. * g++.dg/template/using28.C: New. * g++.dg/template/using29.C: New. Added: branches/gcc-4_7-branch/gcc/testsuite/g++.dg/template/using27.C branches/gcc-4_7-branch/gcc/testsuite/g++.dg/template/using28.C branches/gcc-4_7-branch/gcc/testsuite/g++.dg/template/using29.C Modified: branches/gcc-4_7-branch/gcc/cp/ChangeLog branches/gcc-4_7-branch/gcc/cp/name-lookup.c branches/gcc-4_7-branch/gcc/cp/parser.c branches/gcc-4_7-branch/gcc/testsuite/ChangeLog