How can the operator() of a lambda be declared as noreturn ?
Ideone accepts the following code:
#include
[C++11: 7.6.3/1]:The attribute-tokennoreturnspecifies that a function does not return. It shall appear at most once in each attribute-list and no attribute-argument-clause shall be present. The attribute may be applied to the declarator-id in a function declaration. The first declaration of a function shall specify thenoreturnattribute if any declaration of that function specifies thenoreturnattribute. If a function is declared with thenoreturnattribute in one translation unit and the same function is declared without thenoreturnattribute in another translation unit, the program is ill-formed; no diagnostic required.
I concede that this wording, as is, doesn't prohibit the attribute from appearing elsewhere, but in concert with seeing no evidence anywhere in the standard for it, I don't think this is intended to work with lambda declarations.
Therefore, Clang would be correct.
It may or may not be telling that there was a patch proposal to Clang to allow GCC-style noreturn attributes on lambdas, but not the standard form.
Unfortunately, this feature is not included in GCC's list of extensions, so I can't really see exactly what's going on here.