$ cat test.ii struct GrandParent { void *get(); }; template<class OBJ> struct Parent : public GrandParent{ }; template<typename T> struct Child : public Parent<T> { using GrandParent::get; void Foo() { void* ex = get(); } }; $ clang++ -std=gnu++0x -fsyntax-only test.ii $ g++-4.6 --version g++-4.6 (GCC) 4.6.1 $ g++-4.6 -std=gnu++0x -fsyntax-only test.ii test.ii: In member function 'void Child<T>::Foo()': test.ii:13:20: sorry, unimplemented: unexpected ast of kind using_decl test.ii:13: confused by earlier errors, bailing out $ g++-4.7svn --version g++-4.7svn (GCC) 4.7.0 20110911 (experimental) $ g++-4.7svn -std=gnu++0x -fsyntax-only test.ii test.ii: In member function ‘void Child<T>::Foo()’: test.ii:13:20: sorry, unimplemented: unexpected ast of kind using_decl test.ii:13:20: internal compiler error: in potential_constant_expression_1, at cp/semantics.c:8226 If I change the "get()" line to "(void)get();", g++-4.6.1 succeeds, but g++-4.7 still fails with the same error. Making GrandParent non-dependent by passing a concrete type to Parent<> makes both versions succeed.
Both g++ versions also succeed when passed -std=c++98.
Yes. Luckily the issue seems easy to fix.
This fixes the ICE but I don't know if it's correct and haven't run the testsuite: Index: semantics.c =================================================================== --- semantics.c (revision 178930) +++ semantics.c (working copy) @@ -7751,6 +7751,7 @@ /* We can see a FIELD_DECL in a pointer-to-member expression. */ case FIELD_DECL: case PARM_DECL: + case USING_DECL: return true; case AGGR_INIT_EXPR:
Author: paolo Date: Fri Sep 23 00:54:32 2011 New Revision: 179109 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179109 Log: /cp 2011-09-22 Paolo Carlini <paolo.carlini@oracle.com> PR c++/50491 * semantics.c (potential_constant_expression_1): Handle USING_DECL. /testsuite 2011-09-22 Paolo Carlini <paolo.carlini@oracle.com> PR c++/50491 * g++.dg/cpp0x/pr50491.C: New. Added: trunk/gcc/testsuite/g++.dg/cpp0x/pr50491.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/semantics.c trunk/gcc/testsuite/ChangeLog
Author: paolo Date: Fri Sep 23 00:55:16 2011 New Revision: 179110 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179110 Log: /cp 2011-09-22 Paolo Carlini <paolo.carlini@oracle.com> PR c++/50491 * semantics.c (potential_constant_expression_1): Handle USING_DECL. /testsuite 2011-09-22 Paolo Carlini <paolo.carlini@oracle.com> PR c++/50491 * g++.dg/cpp0x/pr50491.C: New. Added: branches/gcc-4_6-branch/gcc/testsuite/g++.dg/cpp0x/pr50491.C Modified: branches/gcc-4_6-branch/gcc/cp/ChangeLog branches/gcc-4_6-branch/gcc/cp/semantics.c branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
Fixed mainline and 4.6.2.