re PR c++/46420 ([C++0X][4.6 regression] ICE: in tsubst_copy, at cp/pt.c:11677)
authorJason Merrill <jason@redhat.com>
Thu, 11 Nov 2010 06:17:32 +0000 (01:17 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 11 Nov 2010 06:17:32 +0000 (01:17 -0500)
PR c++/46420
* pt.c (tsubst_copy_and_build) [TARGET_EXPR]: New case.
[CONSTRUCTOR]: Use the tsubsted type.

From-SVN: r166592

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

index f85f4b1619f18b26c1b439d1666b9c72d2f70206..75c0c53dc8efef5dc73450fb7032920f0f114d5d 100644 (file)
@@ -1,5 +1,9 @@
 2010-11-10  Jason Merrill  <jason@redhat.com>
 
+       PR c++/46420
+       * pt.c (tsubst_copy_and_build) [TARGET_EXPR]: New case.
+       [CONSTRUCTOR]: Use the tsubsted type.
+
        PR c++/46369
        * semantics.c (cxx_eval_bit_field_ref): New.
        (cxx_eval_constant_expression): Call it.
index 7a06038c67420a3c541fadd97cd42eed8b51d2f5..56b7543504cc96e3a5921aed781bab5d9616b84c 100644 (file)
@@ -13197,6 +13197,7 @@ tsubst_copy_and_build (tree t,
        if (TREE_HAS_CONSTRUCTOR (t))
          return finish_compound_literal (type, r);
 
+       TREE_TYPE (r) = type;
        return r;
       }
 
@@ -13316,6 +13317,12 @@ tsubst_copy_and_build (tree t,
        return build_lambda_object (r);
       }
 
+    case TARGET_EXPR:
+      /* We can get here for a constant initializer of non-dependent type.
+         FIXME stop folding in cp_parser_initializer_clause.  */
+      gcc_assert (TREE_CONSTANT (t));
+      return get_target_expr (RECUR (TARGET_EXPR_INITIAL (t)));
+
     default:
       /* Handle Objective-C++ constructs, if appropriate.  */
       {
index 1115512a2d30e2646ef0fd924b8a76a2ea0e944e..467290d51b0d1b28d0531975d51ee844adc85f1d 100644 (file)
@@ -1,3 +1,7 @@
+2010-11-10  Jason Merrill  <jason@redhat.com>
+
+       * g++.dg/cpp0x/constexpr-46420.C: New.
+
 2010-11-10  Joseph Myers  <joseph@codesourcery.com>
 
        * g++.dg/ext/bitfield2.C, g++.dg/ext/bitfield4.C,
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-46420.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-46420.C
new file mode 100644 (file)
index 0000000..757a6e3
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/46420
+// { dg-options -std=c++0x }
+
+template<typename> class vector { };
+struct A{};
+template <class T1>
+void complete_test(vector<T1> data1){
+        A drop=A();
+}
+int main(){
+  vector<double> vect1;
+  complete_test(vect1);
+}