Hello,

The attached minimal code (test.cpp) causes g++ to 
segfault. It uses the C++0x features variadic templates and initializer 
lists.

The command used to compile it is:

g++ -std=c++0x test.cpp

The output is:

test.cpp: In function ‘void f(const Args& ...) [with Args = ]’:
test.cpp:21:   instantiated from here
test.cpp:16: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.4/README.Bugs> for instructions.

The output of "g++ -v" is:

Using built-in specs.
Target: i486-linux-gnu
Configured
 with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.1-4ubuntu9' 
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs 
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr 
--enable-shared --enable-multiarch --enable-linker-build-id 
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext 
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 
--program-suffix=-4.4 --enable-nls --enable-clocale=gnu 
--enable-libstdcxx-debug --enable-objc-gc --enable-targets=all 
--disable-werror --with-arch-32=i486 --with-tune=generic 
--enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu 
--target=i486-linux-gnu
Thread model: posix
gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu9) 

I also attached the preprocessed source file, as requested (test.ii when 
compiling using -save-temps).

Please let me know if you need any more information.

Regards,
Nate.                                     
#include <initializer_list>

template <typename T>
class my_vector
{
public:
    my_vector(std::initializer_list<T> l);
    
    template <typename InputIterator>
    my_vector(InputIterator first, InputIterator last); 
};

template <typename... Args>
void f(const Args&... args)
{
    my_vector<int> commands{args...};
}

int main(int argc, const char** argv)
{
    f();
}

Attachment: test.ii
Description: Binary data

Reply via email to