This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: va_copy in c++0x-mode
- From: Magnus Fromreide <magfr at lysator dot liu dot se>
- To: gcc-patches at gcc dot gnu dot org
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Wed, 05 Nov 2008 07:49:03 +0100
- Subject: Re: va_copy in c++0x-mode
- References: <1225653625.19621.7.camel@localhost> <490E0C37.4080701@oracle.com> <1225662198.19621.16.camel@localhost> <490E23F2.5000906@oracle.com>
Hello!
The latest C++ draft standard (n2789), section 18.9, says that va_copy
is declared in c++0x but the g++ headers are not yet fixed up to do
that. I think there is a need for a check for __GXX_EXPERIMENTAL_CXX0X__
in gcc/ginclude/stdarg.h
How to test:
g++ -c -std=c++0x test.C
fails to compile.
With the patch the compilation succeds.
/MF
Index: gcc/ginclude/stdarg.h
===================================================================
--- gcc/ginclude/stdarg.h (revision 141538)
+++ gcc/ginclude/stdarg.h (working copy)
@@ -50,7 +50,7 @@
#define va_start(v,l) __builtin_va_start(v,l)
#define va_end(v) __builtin_va_end(v)
#define va_arg(v,l) __builtin_va_arg(v,l)
-#if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L
+#if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L || defined(__GXX_EXPERIMENTAL_CXX0X__)
#define va_copy(d,s) __builtin_va_copy(d,s)
#endif
#define __va_copy(d,s) __builtin_va_copy(d,s)
#include <cstdarg>
void foo(std::va_list ap)
{
std::va_list ap2;
va_copy(ap2, ap);
}