]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/34774 (templates, enumerations, overflow, ice)
authorJason Merrill <jason@redhat.com>
Wed, 13 Feb 2008 07:08:11 +0000 (02:08 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 13 Feb 2008 07:08:11 +0000 (02:08 -0500)
        PR c++/34774
        * pt.c (value_dependent_expression_p): Look into DECL_INITIAL
        of enumerators, too.

From-SVN: r132283

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/template/enum6.C [new file with mode: 0644]

index 9a832de80067bd69aa635366b677c1a07968211d..65bf6234f9e4d77b781f577dfc16ca4ca9abd17d 100644 (file)
@@ -1,3 +1,9 @@
+2008-02-13  Jason Merrill  <jason@redhat.com>
+
+       PR c++/34774
+       * pt.c (value_dependent_expression_p): Look into DECL_INITIAL
+       of enumerators, too.
+
 2008-02-12  Jason Merrill  <jason@redhat.com>
 
        PR c++/34824
index a1e6521c8526246ce75dc5e2138b8561c0310fac..577b62165808257817ff8776a7213317790226c3 100644 (file)
@@ -15638,7 +15638,7 @@ value_dependent_expression_p (tree expression)
       /* A non-type template parm.  */
       if (DECL_TEMPLATE_PARM_P (expression))
        return true;
-      return false;
+      return value_dependent_expression_p (DECL_INITIAL (expression));
 
     case VAR_DECL:
        /* A constant with integral or enumeration type and is initialized
diff --git a/gcc/testsuite/g++.dg/template/enum6.C b/gcc/testsuite/g++.dg/template/enum6.C
new file mode 100644 (file)
index 0000000..9df6d41
--- /dev/null
@@ -0,0 +1,10 @@
+// PR c++/34774
+
+template<int shifts>
+struct shift {
+  enum {
+    n0 = (unsigned)shifts,
+    n = n0 ? 0 : n0,
+    n_comp = -n
+  } x;
+};
This page took 0.090925 seconds and 5 git commands to generate.