-
Notifications
You must be signed in to change notification settings - Fork 18
UnNamed discriminant unions #31
Copy link
Copy link
Open
Description
This may be known behavior but it appears that un-named union types fail:
struct SomeStruct
{
union switch (int v)
{
case 1:
void;
}
value;
};
outputs:
Failed: can't have unnamed type Union(Named("v", Int), [UnionCase(Const(1), Void)], None)
It doesn't look like the RFC specifies that this is needed though.
type-specifier:
[ "unsigned" ] "int"
| [ "unsigned" ] "hyper"
| "float"
| "double"
| "quadruple"
| "bool"
| enum-type-spec
| struct-type-spec
| union-type-spec
| identifier
...
union-type-spec:
"union" union-body
union-body:
"switch" "(" declaration ")" "{"
case-spec
case-spec *
[ "default" ":" declaration ";" ]
"}"
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels