This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/67041] New: [C++14] Variable template initialized by call to lambda does not compile
- From: "ldionne.2 at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 28 Jul 2015 05:45:38 +0000
- Subject: [Bug c++/67041] New: [C++14] Variable template initialized by call to lambda does not compile
- Auto-submitted: auto-generated
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.