From e4e00b14ce1576d402118ab1b08e3d89d921bb75 Mon Sep 17 00:00:00 2001 From: Dennis Korpel Date: Mon, 29 Jul 2024 14:11:11 +0200 Subject: [PATCH] Fix bugzilla 24375 - ImportC: .di generator outputs C expression with `->` operator --- compiler/src/dmd/hdrgen.d | 5 +---- compiler/test/compilable/ctod.i | 11 +++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/compiler/src/dmd/hdrgen.d b/compiler/src/dmd/hdrgen.d index c12d9a2b4b..7f2b225931 100644 --- a/compiler/src/dmd/hdrgen.d +++ b/compiler/src/dmd/hdrgen.d @@ -2682,10 +2682,7 @@ private void expressionPrettyPrint(Expression e, ref OutBuffer buf, ref HdrGenSt void visitDotId(DotIdExp e) { expToBuffer(e.e1, PREC.primary, buf, hgs); - if (e.arrow) - buf.writestring("->"); - else - buf.writeByte('.'); + buf.writeByte('.'); buf.writestring(e.ident.toString()); } diff --git a/compiler/test/compilable/ctod.i b/compiler/test/compilable/ctod.i index 0ecc0f1129..5a631714d0 100644 --- a/compiler/test/compilable/ctod.i +++ b/compiler/test/compilable/ctod.i @@ -36,6 +36,11 @@ extern (C) int x = void; } const(S24326) fun(int y); + struct foo + { + int x = void; + } + alias weird = int[(cast(foo*)cast(void*)0).x.sizeof]; /+enum int __DATE__ = 1+/; /+enum int __TIME__ = 1+/; /+enum int __TIMESTAMP__ = 1+/; @@ -85,3 +90,9 @@ enum { A }; // https://issues.dlang.org/show_bug.cgi?id=24670 struct S24326 { int x; }; const struct S24326 fun(int y); + +// https://issues.dlang.org/show_bug.cgi?id=24375 +struct foo { + int x; +}; +typedef int weird[sizeof(((struct foo *)((void*)0))->x)];