http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47329
Summary: cc1plus segfaults when using variadic function template Product: gcc Version: 4.4.5 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: gmai...@gmail.com g++ reports segfault in cc1plus when attempting to compile code sample provided below: $ g++ -std=c++0x -o test test.cpp g++: Internal error: Segmentation fault (program cc1plus) Please submit a full bug report. See <file:///usr/share/doc/gcc-4.4/README.Bugs> for instructions. $ g++ --version g++ (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5 Copyright (C) 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ------ test.cpp ----------------------- # include <iostream> # include <vector> void print(const std::vector<int>& pack) { for(size_t i=0; i<pack.size(); i++) std::cout << pack[i] << " "; std::cout << "\n"; } template<typename ...Vals> void print(std::vector<int>& pack, int v1, Vals... vals) { pack.push_back(v1); print(pack, vals...); } template<typename ...Vals> void print(Vals... vals) { std::vector<int> pack; print(pack, vals...); } int main() { print(1); print("a"); // <-- this line triggers the failure print(2, 3, 4, 5); print(6, 7); }