http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57658
--- Comment #3 from Takaki Makino <t-gcc-bugzilla at snowelm dot com> --- Created attachment 30336 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30336&action=edit Reduced testcase Hi Paolo, Thank you for referring to the useful resource. Using these tools I've got a reduced version (attached) I believe this is a valid code. $ g++-4.9 -std=c++11 testcase.cpp testcase.cpp: In instantiation of 'X<T>::f() [with T = int]::<lambda()>': testcase.cpp:11:11: required from 'struct X<T>::f() [with T = int]::<lambda()>' testcase.cpp:11:9: required from 'bool X<T>::f() [with T = int]' testcase.cpp:16:16: required from here testcase.cpp:12:62: internal compiler error: in tsubst_copy, at cp/pt.c:12213 typename remove_reference < decltype (a) >::type t; ^ 0x59f7f0 tsubst_copy ../../gcc/cp/pt.c:12213 0x57cee9 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../gcc/cp/pt.c:14484 0x59081c tsubst(tree_node*, tree_node*, int, tree_node*) ../../gcc/cp/pt.c:11807 0x59c8fa tsubst_template_args ../../gcc/cp/pt.c:9640 0x59d2fe tsubst_aggr_type ../../gcc/cp/pt.c:9837 0x590a25 tsubst(tree_node*, tree_node*, int, tree_node*) ../../gcc/cp/pt.c:11695 0x5a1581 tsubst_decl ../../gcc/cp/pt.c:10652 0x5913b4 tsubst(tree_node*, tree_node*, int, tree_node*) ../../gcc/cp/pt.c:11101 0x586eef tsubst_expr ../../gcc/cp/pt.c:12931 0x587284 tsubst_expr ../../gcc/cp/pt.c:13070 0x5864b3 tsubst_expr ../../gcc/cp/pt.c:12880 0x587284 tsubst_expr ../../gcc/cp/pt.c:13070 0x584e5b instantiate_decl(tree_node*, int, bool) ../../gcc/cp/pt.c:19112 0x5bcb67 instantiate_class_template_1 ../../gcc/cp/pt.c:9018 0x5bcb67 instantiate_class_template(tree_node*) ../../gcc/cp/pt.c:9086 0x647dcb complete_type(tree_node*) ../../gcc/cp/typeck.c:131 0x57dd30 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../gcc/cp/pt.c:14581 0x586a12 tsubst_expr ../../gcc/cp/pt.c:13415 0x586f6f tsubst_expr ../../gcc/cp/pt.c:12894 0x5864b3 tsubst_expr ../../gcc/cp/pt.c:12880 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions.