OSDN Git Service

PR c++/51854
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 16 Jan 2012 21:32:14 +0000 (21:32 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 16 Jan 2012 21:32:14 +0000 (21:32 +0000)
* mangle.c (write_template_arg_literal): Handle complex.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183222 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/mangle.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/abi/mangle60.C [new file with mode: 0644]

index e3ef5f2..e90f833 100644 (file)
@@ -1,3 +1,8 @@
+2012-01-16  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/51854
+       * mangle.c (write_template_arg_literal): Handle complex.
+
 2012-01-16  Jason Merrill  <jason@redhat.com>
 
        PR c++/51827
 2012-01-16  Jason Merrill  <jason@redhat.com>
 
        PR c++/51827
index 15b1aca..34f19ef 100644 (file)
@@ -2927,6 +2927,25 @@ write_template_arg_literal (const tree value)
        write_real_cst (value);
        break;
 
        write_real_cst (value);
        break;
 
+      case COMPLEX_CST:
+       if (TREE_CODE (TREE_REALPART (value)) == INTEGER_CST
+           && TREE_CODE (TREE_IMAGPART (value)) == INTEGER_CST)
+         {
+           write_integer_cst (TREE_REALPART (value));
+           write_char ('_');
+           write_integer_cst (TREE_IMAGPART (value));
+         }
+       else if (TREE_CODE (TREE_REALPART (value)) == REAL_CST
+                && TREE_CODE (TREE_IMAGPART (value)) == REAL_CST)
+         {
+           write_real_cst (TREE_REALPART (value));
+           write_char ('_');
+           write_real_cst (TREE_IMAGPART (value));
+         }
+       else
+         gcc_unreachable ();
+       break;
+
       case STRING_CST:
        sorry ("string literal in function template signature");
        break;
       case STRING_CST:
        sorry ("string literal in function template signature");
        break;
index 9fa8e43..af5f550 100644 (file)
@@ -1,5 +1,8 @@
 2012-01-16  Jason Merrill  <jason@redhat.com>
 
 2012-01-16  Jason Merrill  <jason@redhat.com>
 
+       PR c++/51854
+       * g++.dg/abi/mangle60.C: New.
+
        PR c++/51827
        * g++.dg/pch/mangle1.{C,Hs}: New.
 
        PR c++/51827
        * g++.dg/pch/mangle1.{C,Hs}: New.
 
diff --git a/gcc/testsuite/g++.dg/abi/mangle60.C b/gcc/testsuite/g++.dg/abi/mangle60.C
new file mode 100644 (file)
index 0000000..f7e893a
--- /dev/null
@@ -0,0 +1,20 @@
+// PR c++/51854
+// { dg-options "" }
+
+template <unsigned N> struct A;
+
+template <typename U, typename V>
+char foo(U, V);
+
+// { dg-final { scan-assembler "_Z3barIiEvP1AIXszcl3foocvT__ELCi0_42EEEE" } }
+template <typename U>
+void bar(A<sizeof(foo(U(), 42i))> *);
+
+// { dg-final { scan-assembler "_Z3bazIiEvP1AIXszcl3foocvT__ELCf00000000_00000000EEEE" } }
+template <typename U>
+void baz(A<sizeof(foo(U(), 0.0fj))> *);
+
+int main() {
+   bar<int>(0);
+   baz<int>(0);
+}