https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67838
Bug ID: 67838 Summary: Rejects-valid-code: templated lambda variable. Product: gcc Version: 5.2.1 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: bisqwit at iki dot fi Target Milestone: --- GCC 5.2 fails to compile the code below, erroneously citing "error: use of 'TestFunc<false>' before deduction of 'auto'". Compiles fine in Clang 3.5. #include <stdio.h> template<bool LMode> static auto TestFunc = [](int param1) { return param1; }; template<typename Func> static void test(Func func) { printf("%d\n", func(12345)); } int main() { test(TestFunc<false>); test(TestFunc<true>); }