This is the mail archive of the gcc@gcc.gnu.org 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]

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


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