Open
Description
Full name of submitter (unless configured in github; will be published with the issue): Hubert Tong
Reference (section label): class.union.anon
Link to reflector thread (if any): N/A
Issue description:
https://eel.is/c++draft/class.union.anon#1.sentence-3 says:
Nested types, anonymous unions, and functions shall not be declared within an anonymous union.
A lambda expression declares a closure type (https://eel.is/c++draft/expr.prim.lambda#closure-2).
Does that mean that lambda expressions are disallowed in anonymous unions?
Only EDG generates a diagnostic for https://godbolt.org/z/xf96EbKTn:
static union {
int x = [] { return 42; }();
};
Suggested resolution:
Nested types, including closure types and anonymous unions, and functions shall not be declared within an anonymous union.
Metadata
Metadata
Assignees
Labels
No labels