atilaneves / dpp

Directly include C headers in D source code
Boost Software License 1.0
229 stars 31 forks source link

Do not translate aggregate definition more than once, but translate it when it’s needed. #298

Closed alexandrumc closed 2 years ago

alexandrumc commented 2 years ago

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.