re PR c++/9457 (ICE in tsubst_copy, at cp/pt.c:7124)
authorKriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
Mon, 17 Feb 2003 15:42:58 +0000 (15:42 +0000)
committerKriang Lerdsuwanakij <lerdsuwa@gcc.gnu.org>
Mon, 17 Feb 2003 15:42:58 +0000 (15:42 +0000)
PR c++/9457
* pt.c (tsubst_copy_and_build) [CONSTRUCTOR]: Substitute
CONSTRUCTOR_ELTS only once.

* g++.dg/template/init1.C: New test.

From-SVN: r63002

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

index 85bc0e46c6bb7ba1032f14624a8177fba79413f1..7278ec4e6fbb4d1ba1b8e451d620a68e65db69f7 100644 (file)
@@ -1,3 +1,9 @@
+2003-02-17  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
+
+       PR c++/9457
+       * pt.c (tsubst_copy_and_build) [CONSTRUCTOR]: Substitute
+       CONSTRUCTOR_ELTS only once.
+
 2003-02-16  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
 
        PR c++/9459
index d04ec2356a9b2b786b272e9d0ccf553b9fb93dc9..959bd54e93d032c9348fab289433dd218de5e4c9 100644 (file)
@@ -8290,8 +8290,7 @@ tsubst_copy_and_build (t, args, complain, in_decl)
           initializers as they are identifier nodes which will be
           looked up by digest_init.  */
        purpose_p = !(type && IS_AGGR_TYPE (type));
-       for (elts = tsubst_copy (CONSTRUCTOR_ELTS (t), args, complain,
-                                in_decl);
+       for (elts = CONSTRUCTOR_ELTS (t);
             elts;
             elts = TREE_CHAIN (elts))
          {
index 0356de92d986845cbec61b3a3022e84a467aa61d..bf170897512f4faed6919fe2eb45c920b9180bc2 100644 (file)
@@ -1,3 +1,8 @@
+2003-02-17  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
+
+       PR c++/9457
+       * g++.dg/template/init1.C: New test.
+
 Sun Feb 16 23:08:19 CET 2003  Jan HUbicka  <jh@suse.cz>
 
        * gcc.dg/c90-const-expr-3.c (DZERO): New static variable
diff --git a/gcc/testsuite/g++.dg/template/init1.C b/gcc/testsuite/g++.dg/template/init1.C
new file mode 100644 (file)
index 0000000..fdbff8d
--- /dev/null
@@ -0,0 +1,10 @@
+// { dg-do compile }
+
+// Origin: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
+
+// PR c++/9457: ICE tsubst'ing initializers in templates.
+
+template <typename> void foo (int count) {
+  int i = {count};
+}
+template void foo<int> (int);