Patchwork C++ PATCH for c++/46304 (ICE with COMPLEX_CST in template)

login
register
mail settings
Submitter Jason Merrill
Date Nov. 5, 2010, 5:55 a.m.
Message ID <4CD39C4A.3060403@redhat.com>
Download mbox | patch
Permalink /patch/70243/
State New
Headers show

Comments

Jason Merrill - Nov. 5, 2010, 5:55 a.m.
My recent rework of tsubst_copy needed to include COMPLEX_CST.

Tested x86_64-pc-linux-gnu, applied to trunk.
commit f002d2b948e858357d3bb5083359a9b73413ab90
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Nov 5 01:12:17 2010 -0400

    	PR c++/46304
    	* pt.c (tsubst_copy): Handle COMPLEX_CST.

Patch

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index ca2baeb..ed04b2b 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -11658,6 +11658,7 @@  tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
     case INTEGER_CST:
     case REAL_CST:
     case STRING_CST:
+    case COMPLEX_CST:
       {
 	/* Instantiate any typedefs in the type.  */
 	tree type = tsubst (TREE_TYPE (t), args, complain, in_decl);
diff --git a/gcc/testsuite/g++.dg/ext/complex6.C b/gcc/testsuite/g++.dg/ext/complex6.C
new file mode 100644
index 0000000..9a7c50a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/complex6.C
@@ -0,0 +1,10 @@ 
+// PR c++/46304
+// { dg-options "" }
+
+template<class T>
+void f()
+{
+  __complex double d =  1.0 + 2.0i;
+}
+
+template void f<int>();