Hi,

this is just an ICE on invalid, but it's a 4_8/4_9 Regression, and, more importantly, we don't emit any sensible error message before ICEing. It manifests itself as TEMPLATE_PARM_INDEX unhandled by the main cxx_eval_constant_expression switch, and just adding the code to the bunch of those returned untouched leads to the same error message of 4_7 and no ICE. Not sure at the moment whether something deeper is going on, though.

Tested x86_64-linux.

Thanks,
Paolo.

//////////////////////////////
/cp
2013-10-11  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/58466
        * semantics.c (cxx_eval_constant_expression): Handle 
        TEMPLATE_PARM_INDEX.

/testsuite
2013-10-11  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/58466
        * g++.dg/cpp0x/variadic145.C: New.
Index: cp/semantics.c
===================================================================
--- cp/semantics.c      (revision 203449)
+++ cp/semantics.c      (working copy)
@@ -9335,6 +9335,7 @@ cxx_eval_constant_expression (const constexpr_call
     case FUNCTION_DECL:
     case TEMPLATE_DECL:
     case LABEL_DECL:
+    case TEMPLATE_PARM_INDEX:
       return t;
 
     case PARM_DECL:
Index: testsuite/g++.dg/cpp0x/variadic145.C
===================================================================
--- testsuite/g++.dg/cpp0x/variadic145.C        (revision 0)
+++ testsuite/g++.dg/cpp0x/variadic145.C        (working copy)
@@ -0,0 +1,10 @@
+// PR c++/58466
+// { dg-do compile { target c++11 } }
+
+template<char, char...> struct A;
+
+template<typename> struct B;
+
+template<char... C> struct B<A<C...>> {};
+
+B<A<'X'>> b;        // { dg-error "incomplete type" }

Reply via email to