Hi folks,
the following C++ snippet used to compile, but doesn't anymore with current gcc
trunk.
Hope this helps!
Thanks,
Sebastien Alaiwan
-----------------
// simple.cpp
int getValueOfSix()
{
return 6;
}
template<int A>
void f()
{
auto const c = getValueOfSix();
auto lambda = [&] ()
{
auto a = c;
auto b = c;
};
}
void g()
{
f<0>();
}
-----------------
Here are the errors I get:
$ g++ -c -std=c++11 simple.cpp
simple.cpp: In instantiation of ‘f()::<lambda()> [with int A = 0]’:
simple.cpp:12:19: required from ‘struct f() [with int A = 0]::<lambda()>’
simple.cpp:16:3: required from ‘void f() [with int A = 0]’
simple.cpp:21:8: required from here
simple.cpp:15:14: error: redeclaration of ‘const int& c’
auto b = c;
^
simple.cpp:14:14: note: ‘const int& c’ previously declared here
auto a = c;
^
simple.cpp: In instantiation of ‘void f() [with int A = 0]’:
simple.cpp:21:8: required from here
simple.cpp:12:17: sorry, unimplemented: non-trivial designated initializers not
supported
auto lambda = [&] ()
^