]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/63415 (internal compiler error: unexpected expression ‘static_cast<int...
authorJason Merrill <jason@redhat.com>
Wed, 15 Oct 2014 16:46:29 +0000 (12:46 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 15 Oct 2014 16:46:29 +0000 (12:46 -0400)
PR c++/63415
* pt.c (value_dependent_expression_p) [CONSTRUCTOR]: Check the type.
(iterative_hash_template_arg): Likewise.

From-SVN: r216276

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

index 1dec9eced874656d59c0455b7c3146a9bf10cdfb..643b5cb74224e1ef67d624699f29819f5d72a6a7 100644 (file)
@@ -1,5 +1,9 @@
 2014-10-15  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++/56710
        * semantics.c (finish_member_declaration): Don't push closure
        members.
index 83aedd78dba8789904129760f5d15cda7eeeef74..eadb0786f9a8e3bdcce645a0986cb6923c4a0271 100644 (file)
@@ -1571,6 +1571,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);
@@ -19826,6 +19827,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{});
+};