This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: va_copy in c++0x-mode


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.

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)
 #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);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]