http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53783
Bug #: 53783 Summary: [4.8 Regression] lambda in lambda in template function rejected Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: lu...@math.hu-berlin.de The following valid program is rejected (using latest version from trunk) template <class> void foo() { [] { [] {}; }; } int main() { foo<void>(); } daniel@daniel-VirtualBox:~/projects/Code/gcctest$ /opt/gcc/trunk/bin/g++ -std=c++11 test.cpp test.cpp: In instantiation of ‘foo() [with <template-parameter-1-1> = void]::<lambda()>’: test.cpp:1:32: required from ‘struct foo() [with <template-parameter-1-1> = void]::<lambda()>’ test.cpp:1:31: required from ‘void foo() [with <template-parameter-1-1> = void]’ test.cpp:2:24: required from here test.cpp:1:36: error: use of ‘foo() [with <template-parameter-1-1> = void]::<lambda()>’ before deduction of ‘auto’ template <class> void foo() { [] { [] {}; }; } ^ test.cpp: In instantiation of ‘struct foo() [with <template-parameter-1-1> = void]::<lambda()>::<lambda()>’: test.cpp:1:36: required from ‘foo() [with <template-parameter-1-1> = void]::<lambda()>’ test.cpp:1:32: required from ‘struct foo() [with <template-parameter-1-1> = void]::<lambda()>’ test.cpp:1:31: required from ‘void foo() [with <template-parameter-1-1> = void]’ test.cpp:2:24: required from here test.cpp:1:37: error: use of ‘foo() [with <template-parameter-1-1> = void]::<lambda()>::<lambda()>’ before deduction of ‘auto’ template <class> void foo() { [] { [] {}; }; } ^ test.cpp:1:37: error: invalid use of ‘auto’ test.cpp:1:37: error: inconsistent deduction for ‘auto’: ‘auto’ and then ‘void’