re PR c++/63415 (internal compiler error: unexpected expression ‘static_cast<int...
authorJason Merrill <jason@redhat.com>
Thu, 9 Oct 2014 18:05:23 +0000 (14:05 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 9 Oct 2014 18:05:23 +0000 (14:05 -0400)
PR c++/63415
* pt.c (value_dependent_expression_p) [CONSTRUCTOR]: Check the type.
(iterative_hash_template_arg): Likewise.

From-SVN: r216043

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp0x/constexpr-initlist8.C [new file with mode: 0644]

index 744854855c668bb3e3f93f0360abd92f71d0ae0b..09aad7db461b3adbf8bceacfdef9a8da5b52d8d0 100644 (file)
@@ -1,5 +1,9 @@
 2014-10-09  Jason Merrill  <jason@redhat.com>
 
+       PR c++/63415
+       * pt.c (value_dependent_expression_p) [CONSTRUCTOR]: Check the type.
+       (iterative_hash_template_arg): Likewise.
+
        PR c++/63437
        * cp-tree.h (REF_PARENTHESIZED_P): Also allow INDIRECT_REF.
        * semantics.c (force_paren_expr): And set it.
index 7d380e54b4ac1c005da6b311937baf262bcbd248..85af59d7a5c4982f443c4a3fc108642a5bc1a372 100644 (file)
@@ -1598,6 +1598,7 @@ iterative_hash_template_arg (tree arg, hashval_t val)
     case CONSTRUCTOR:
       {
        tree field, value;
+       iterative_hash_template_arg (TREE_TYPE (arg), val);
        FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (arg), i, field, value)
          {
            val = iterative_hash_template_arg (field, val);
@@ -21062,6 +21063,8 @@ value_dependent_expression_p (tree expression)
       {
        unsigned ix;
        tree val;
+       if (dependent_type_p (TREE_TYPE (expression)))
+         return true;
        FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (expression), ix, val)
          if (value_dependent_expression_p (val))
            return true;
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist8.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist8.C
new file mode 100644 (file)
index 0000000..3d859a8
--- /dev/null
@@ -0,0 +1,7 @@
+// PR c++/63415
+// { dg-do compile { target c++11 } }
+
+template <typename T>
+struct A {
+  static constexpr int value = int(T{});
+};