A nickname for an anonymous struct might be generated without having to translate the anonymous struct as well (e.g. from a FieldDecl, see test). In such a case, hasNickname would return true in translateNonFunction, so the anonymous struct would never get defined, resulting in a compilation error.
aggregateIsRemembered is better check because rememberAggregate is only called when an aggregate’s definition gets translated, so it’s exactly what we need.
A nickname for an anonymous struct might be generated without having to translate the anonymous struct as well (e.g. from a FieldDecl, see test). In such a case,
hasNickname
would returntrue
intranslateNonFunction
, so the anonymous struct would never get defined, resulting in a compilation error.aggregateIsRemembered
is better check becauserememberAggregate
is only called when an aggregate’s definition gets translated, so it’s exactly what we need.