OSDN Git Service

PR c++/34774
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Feb 2008 07:08:11 +0000 (07:08 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Feb 2008 07:08:11 +0000 (07:08 +0000)
        * pt.c (value_dependent_expression_p): Look into DECL_INITIAL
        of enumerators, too.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@132283 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 9a832de..65bf623 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 a1e6521..577b621 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;
+};