New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[basic.def.odr] lambda-expression example seemingly constradicts normative wording #6364
Comments
I think p14.6 specifies behavior of implementations, while the example shows potentially invalid use in user codes due to such behavior, so there's no contradiction. |
My issue is that 14.6 says except within the default arguments, so it seemingly excludes the behavior described in the example. The recursive call to |
It's saying that the closure types are the same except in that case. |
It's not saying that; the quote I've posted is just one of many requirements for the ODR not to be violated. |
After discussing it with a handful of other people, we managed to wrap our heads around it. A much better example would be: inline void g(void (*p)() = []{}) {}
inline void g2() {
// ill-formed, no diagnostic required
// use of default argument defines a closure type outside of g2
// which is not the same across TUs
g();
} |
So the current example also requires http://eel.is/c++draft/basic.def.odr#14.11 to make sense. |
Not really. It may look like p14.11 is relevant to the example with |
On one hand, lambda-expressions in default arguments are not required to have the same closure type:
http://eel.is/c++draft/basic.def.odr#14.6
On the other hand, the example shows the opposite:
http://eel.is/c++draft/basic.def.odr#16
I can't make sense of it; it seems like a direct contradiction to me.
The text was updated successfully, but these errors were encountered: