re PR c++/31488 (va_list considered non-POD)
authorJason Merrill <jason@redhat.com>
Mon, 12 Jan 2009 21:07:46 +0000 (16:07 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 12 Jan 2009 21:07:46 +0000 (16:07 -0500)
        PR c++/31488
        * tree.c (pod_type_p): Return 1 for structs created by the back end.

From-SVN: r143308

gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/vararg-3.C [new file with mode: 0644]

index c81a1e63881704d9268e6beeba6f63a4e38f10a3..1a9ca4fc4c92e344b666bfa0123017f5de362214 100644 (file)
@@ -1,3 +1,8 @@
+2009-01-12  Jason Merrill  <jason@redhat.com>
+
+       PR c++/31488
+       * tree.c (pod_type_p): Return 1 for structs created by the back end.
+
 2009-01-12  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/32041
index 1f2c6319ece66c219d820c781178620b4873cdbf..ad84cc8d8d3f3be7a65bd2e9e9179e3ecf1670ec 100644 (file)
@@ -2127,8 +2127,10 @@ pod_type_p (const_tree t)
   if (TREE_CODE (t) == VECTOR_TYPE)
     return 1; /* vectors are (small) arrays of scalars */
 
-  if (! CLASS_TYPE_P (t))
+  if (! RECORD_OR_UNION_CODE_P (TREE_CODE (t)))
     return 0; /* other non-class type (reference or function) */
+  if (! CLASS_TYPE_P (t))
+    return 1; /* struct created by the back end */
   if (CLASSTYPE_NON_POD_P (t))
     return 0;
   return 1;
index 5a54e1e92e8e4617807cbc2d77c03b05b1ad2266..9ae7b395cb8f6831791a632be333cf5c2fc86bd6 100644 (file)
@@ -1,3 +1,7 @@
+2009-01-12  Jason Merrill  <jason@redhat.com>
+
+       * g++.dg/other/vararg-3.C: New test.
+
 2009-01-12  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * gcc.target/powerpc/ppc-spe.c: Compile for all EABI targets.
diff --git a/gcc/testsuite/g++.dg/other/vararg-3.C b/gcc/testsuite/g++.dg/other/vararg-3.C
new file mode 100644 (file)
index 0000000..4585f32
--- /dev/null
@@ -0,0 +1,16 @@
+// PR c++/31488: va_list considered non-POD on alpha
+// { dg-do compile }
+
+typedef __builtin_va_list __gnuc_va_list;
+typedef __gnuc_va_list va_list;
+
+extern int foo (int a, int b, ...);
+
+int bar (int a, int b, ...)
+{
+  va_list args;
+  __builtin_va_start(args,b);
+  int result = foo (a, b, args);
+  __builtin_va_end(args);
+  return result;
+}