You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CWG2781 [basic.def.odr] "... for D itself, the behavior is as if there is a single entity with a single definition" renders the complere ODR teethless #402
In each such definition, corresponding names, looked up according to [basic.lookup], shall refer to the same entity, ...
int x;
inline int f() { return x; } // refers to different entities!
But there is a rule in p15:
For each such entity and for D itself, the behavior is as if there is a single entity with a single definition, including in the application of these requirements to other entities.
Therefore, the above code example is not anymore IFNDR because the behave is "as if" there is only a single definition of f? I hear that this is not the case, because the requirements still apply. So if we change f to this:
inline int f() { return []{return 0;}(); }
If we check the requirements in p14 and then for the remainder of the spec behave as if there was only a single definition of D (which is what prior specs said), then the requirement in p14 that says this is violated and the function f becomes IFNDR:
In each such definition, except within the default arguments and default template arguments of D, corresponding lambda-expressions shall have the same closure type