http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48736
Summary: [C++0x] ICE during list-initialization with variadics
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
The following code causes an internal compiler error with gcc 4.7.0 20110422
(experimental) in C++0x mode at the line marked with X:
//-------------
template<class T>
T&& create();
template<class T, class... Args,
class = decltype(T{create<Args>()...}) // Line X
>
char f(int);
//-------------
"internal compiler error: tree check: expected tree_vec, have
expr_pack_expansion in tsubst_copy_and_build, at cp/pt.c:13227"
For those who need this kind of sfinae-like expression: The current workaround
is to rewrite above code into the following form:
//-------------
template<class T>
T&& create();
template<class T, class... Args>
decltype(T{create<Args>()...}, char()) f(int);
//-------------