From c1a753bca3a1883ff97f51d07386f31c5473594a Mon Sep 17 00:00:00 2001 From: bangbangsheshotmedown Date: Sun, 3 Nov 2024 07:35:32 +0000 Subject: [PATCH] Fix bugzilla issue 24153 - Inliner breaks -betterC by requiring TypeInfo (#17049) --- compiler/src/dmd/expressionsem.d | 7 +++++-- compiler/test/compilable/betterCinline.d | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 compiler/test/compilable/betterCinline.d diff --git a/compiler/src/dmd/expressionsem.d b/compiler/src/dmd/expressionsem.d index b26ce2380f9a..b137bdb949c7 100644 --- a/compiler/src/dmd/expressionsem.d +++ b/compiler/src/dmd/expressionsem.d @@ -17184,8 +17184,11 @@ void semanticTypeInfo(Scope* sc, Type t) Scope scx; scx.eSink = global.errorSink; scx._module = sd.getModule(); - getTypeInfoType(sd.loc, t, &scx); - sd.requestTypeInfo = true; + if (global.params.useTypeInfo) + { + getTypeInfoType(sd.loc, t, &scx); + sd.requestTypeInfo = true; + } } else if (!sc.minst) { diff --git a/compiler/test/compilable/betterCinline.d b/compiler/test/compilable/betterCinline.d new file mode 100644 index 000000000000..31cc8498b0da --- /dev/null +++ b/compiler/test/compilable/betterCinline.d @@ -0,0 +1,22 @@ +/* REQUIRED_ARGS: -betterC -inline + PERMUTE_ARGS: +*/ + +struct InvBoneBindInfo +{ +} + + +struct Test(Value) +{ + void test() + { + auto t = Value.init; + } +} + +extern(C) void main() +{ + Test!(InvBoneBindInfo[32]) test; + test.test(); +}