This follows from another question.
The following program compiles on gcc and icc, but fails to compile on VS and clang:
template <typename Y>
auto add_value(Y y)
{
const short z{9};
return [y](auto x)
{
return z;
};
}
int main()
{
add_value(2);
}
Flags were: -std=c++14 -O2 -Wall -Wshadow -pedantic -pthread
Which is correct? I suppose gcc is correct here? But I would prefer for this to fail.