https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67041
Bug ID: 67041 Summary: [C++14] Variable template initialized by call to lambda does not compile Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ldionne.2 at gmail dot com Target Milestone: --- The following code does not compile on GCC trunk: ------------------------------- template <typename ...Anything> auto variable_template = [] { return 1; }(); int main() { variable_template<>; } ------------------------------- The error is --------------------------------- prog.cc: In instantiation of 'auto variable_template<>': prog.cc:5:5: required from here prog.cc:2:42: error: use of 'variable_template<>' before deduction of 'auto' auto variable_template = [] { return 1; }(); ^ prog.cc:2:42: error: use of '<lambda()> [with Anything = {}]' before deduction of 'auto' --------------------------------- Live example: http://melpon.org/wandbox/permlink/srH8coYkvigwJSkb Note that Clang compiles this code fine.