This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/67838] New: Rejects-valid-code: templated lambda variable.
- From: "bisqwit at iki dot fi" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 04 Oct 2015 12:31:26 +0000
- Subject: [Bug c++/67838] New: Rejects-valid-code: templated lambda variable.
- Auto-submitted: auto-generated
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>);
}