ImportC: can't access members in static array (#21185)

Fixes https://github.com/dlang/dmd/issues/20472

Arrays in C implicitly convert to a pointer to their first member,
so do the implicit conversion when using them in an arrow member lookup.
This commit is contained in:
drpriver 2025-04-09 02:58:14 -07:00 committed by GitHub
parent 7dd0506aaf
commit ca2f90d1fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 21 additions and 2 deletions

View file

@ -126,6 +126,12 @@ Expression fieldLookup(Expression e, Scope* sc, Identifier id, bool arrow)
e = e.expressionSemantic(sc);
if (e.isErrorExp())
return e;
if (arrow)
{
e = arrayFuncConv(e, sc);
if (e.isErrorExp())
return e;
}
auto t = e.type;
if (t.isTypePointer())