This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
c++ 3.1 branch 20020327 (prerelease) - var args compilation failure - O2 problem on i686
- From: George France <france at handhelds dot org>
- To: gcc at gcc dot gnu dot org
- Cc: clp at iol dot unh dot edu
- Date: Tue, 9 Apr 2002 19:43:50 -0400
- Subject: c++ 3.1 branch 20020327 (prerelease) - var args compilation failure - O2 problem on i686
Greetings,
The following program compiles with out any optimizations, but fails to
compile with -O2. Try:
../gcc-3.1.0/bin/g++ -O2 va_bug.cc
will result in the following error messages:
va_bug.cc: In function `int main(int, vchar**)':
va_bug.cc:23: `va_start' used in function with fixed args
Best Regards,
--George
---------------
#include <cstdio>
#include <cstdarg>
#include <iostream>
template <class T>
class BaseTuple_t
{
public:
BaseTuple_t(
const T t0)
{
vcreate(1,
t0);
}
void
vcreate(
const size_t num_elts,
...)
{
va_list ap;
va_start(ap, num_elts);
std::cout << "Hello, bug" << std::endl;
}
};
typedef BaseTuple_t<int> Tuple_t;
int
main(
int argc,
char* argv[])
{
Tuple_t t2(111);
}