To my surprise, the following program compiles just fine:
int main()
{
int i = 4;
[j = i]{}();
}
> g++ --std=c++11 ext.cpp
>
The problem is that I want this to fail: Generalized Lambda Capture is a C++14 feature, and my current project has a requirement for C++11.
Now, Clang compiles this too with a warning, which I can promote to an error using -Werror=c++14-extensions. However, I can find no similar flag for g++. I can use -pedantic-errors or -Werror=pedantic, but those come with way, way more baggage.
Have I overlooked some compiler option for this compiler?
Aucun commentaire:
Enregistrer un commentaire