OSDN Git Service

2006-08-29 Andrew Pinski <pinskia@physics.uc.edu>
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 30 Aug 2006 04:33:10 +0000 (04:33 +0000)
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 30 Aug 2006 04:33:10 +0000 (04:33 +0000)
        PR c++/28349
        * testsuite/g++.dg/warn/var-args1.C: New test.
2006-08-29  Andrew Pinski  <pinskia@physics.uc.edu>

        PR C++/28349
        * call.c (build_x_va_arg): Remove the reference type
        from the type before creating the pointer type.

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

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/warn/var-args1.C [new file with mode: 0644]

index 3774c14..cda2742 100644 (file)
@@ -1,3 +1,9 @@
+2006-08-29  Andrew Pinski  <pinskia@physics.uc.edu>
+
+       PR C++/28349
+       * call.c (build_x_va_arg): Remove the reference type
+       from the type before creating the pointer type.
+
 2006-08-29  J"orn Rennecke  <joern.rennecke@st.com>
 
        PR c++/28139
index a91ecd0..7a6646f 100644 (file)
@@ -4544,10 +4544,12 @@ build_x_va_arg (tree expr, tree type)
 
   if (! pod_type_p (type))
     {
+      /* Remove reference types so we don't ICE later on.  */
+      tree type1 = non_reference (type);
       /* Undefined behavior [expr.call] 5.2.2/7.  */
       warning (0, "cannot receive objects of non-POD type %q#T through %<...%>; "
               "call will abort at runtime", type);
-      expr = convert (build_pointer_type (type), null_node);
+      expr = convert (build_pointer_type (type1), null_node);
       expr = build2 (COMPOUND_EXPR, TREE_TYPE (expr),
                     call_builtin_trap (), expr);
       expr = build_indirect_ref (expr, NULL);
index 6729166..15f5d63 100644 (file)
@@ -1,3 +1,8 @@
+2006-08-29  Andrew Pinski  <pinskia@physics.uc.edu>
+
+       PR c++/28349
+       * testsuite/g++.dg/warn/var-args1.C: New test.
+
 2006-08-29  Steven G. Kargl  <kargls@comcast.net>
 
        PR fortran/28866
diff --git a/gcc/testsuite/g++.dg/warn/var-args1.C b/gcc/testsuite/g++.dg/warn/var-args1.C
new file mode 100644 (file)
index 0000000..aadac20
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+
+#include <stdarg.h>
+
+void foo(int, ...)
+{
+    va_list va;
+    int i;
+    i = va_arg(va, int&); /* { dg-warning "cannot receive objects" } */
+}
+