Macros don't expand in record or struct field types #77
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Macros are not expanded when they appear in a record's field type. The call is carried through as a type, and
sexcemits C that cannot compile.sexc -mleaves the call in the type position:sexc -Cemits:The simplest case shows it is not about the macro's result being a complex type:
sexc -Cemitsty x;and exits 0.structfields behave the same:varandtypedeftype positions too:Function headers do expand:
so the behaviour is inconsistent: function signature types are expanded, but record/struct fields,
vartypes andtypedeftargets are not.Expected:
sex-error, rather than emitting invalid C and exiting 0.For record/struct fields the expansion must happen before
register-aggregate!, so field lookup and later type checking see the expanded type.