From 4d5f5fd4d975a1eda386d3baa1ecf2c847a8bdb2 Mon Sep 17 00:00:00 2001 From: Walter Bright Date: Sun, 13 Oct 2013 16:11:03 -0700 Subject: [PATCH] fix Issue 11239 - [REG2.064beta] ctRegex causes link errors with -debug since Pull2550 --- src/glue.c | 7 +++++++ test/runnable/imports/inc11239.d | 11 +++++++++++ test/runnable/test11239.d | 11 +++++++++++ 3 files changed, 29 insertions(+) create mode 100644 test/runnable/imports/inc11239.d create mode 100644 test/runnable/test11239.d diff --git a/src/glue.c b/src/glue.c index f279ad9195a2..1e9751ba5b3a 100644 --- a/src/glue.c +++ b/src/glue.c @@ -586,6 +586,13 @@ void FuncDeclaration::toObjFile(int multiobj) */ TemplateInstance *ti = inTemplateInstance(); if (!global.params.useUnitTests && + !global.params.allInst && + /* The issue is that if the importee is compiled with a different -debug + * setting than the importer, the importer may believe it exists + * in the compiled importee when it does not, when the instantiation + * is behind a conditional debug declaration. + */ + !global.params.debuglevel && // workaround for Bugzilla 11239 ti && ti->instantiatingModule && !ti->instantiatingModule->isRoot()) { Module *mi = ti->instantiatingModule; diff --git a/test/runnable/imports/inc11239.d b/test/runnable/imports/inc11239.d new file mode 100644 index 000000000000..494f147dd2fd --- /dev/null +++ b/test/runnable/imports/inc11239.d @@ -0,0 +1,11 @@ +// REQUIRED_ARGS: + +int foo(T)(T x) +{ + return 3; +} + +debug +{ + int x = foo(2); +} diff --git a/test/runnable/test11239.d b/test/runnable/test11239.d new file mode 100644 index 000000000000..9ace1cf95ab4 --- /dev/null +++ b/test/runnable/test11239.d @@ -0,0 +1,11 @@ +// EXTRA_SOURCES: imports/inc11239.d +// REQUIRED_ARGS: -debug +// COMPILE_SEPARATELY +// PERMUTE_ARGS: + +import imports.inc11239; + +void main() +{ + foo(1); +}