diff --git a/src/dmd/glue.d b/src/dmd/glue.d index a4c08756a7e7..20d06e8a280f 100644 --- a/src/dmd/glue.d +++ b/src/dmd/glue.d @@ -386,13 +386,10 @@ void genObjFile(Module m, bool multiobj) if (global.params.cov) { /* Create coverage identifier: - * private uint[numlines] __coverage; + * uint[numlines] __coverage; */ - m.cov = symbol_calloc("__coverage"); - m.cov.Stype = type_fake(TYint); - m.cov.Stype.Tmangle = mTYman_c; - m.cov.Stype.Tcount++; - m.cov.Sclass = SCstatic; + m.cov = toSymbolX(m, "__coverage", SCglobal, type_fake(TYint), "Z"); + m.cov.Stype.Tmangle = mTYman_d; m.cov.Sfl = FLdata; scope dtb = new DtBuilder(); @@ -1575,4 +1572,3 @@ elem *toEfilenamePtr(Module m) Symbol* s = toStringSymbol(id, len, 1); return el_ptr(s); } - diff --git a/test/runnable/extra-files/lib13742a.d b/test/runnable/extra-files/lib13742a.d new file mode 100644 index 000000000000..762559bc12c4 --- /dev/null +++ b/test/runnable/extra-files/lib13742a.d @@ -0,0 +1,6 @@ +module lib13742a; + +void performLocked(alias PROC)() +{ + PROC(); +} diff --git a/test/runnable/extra-files/lib13742b.d b/test/runnable/extra-files/lib13742b.d new file mode 100644 index 000000000000..03163b5504e0 --- /dev/null +++ b/test/runnable/extra-files/lib13742b.d @@ -0,0 +1,8 @@ +module lib13742b; +import lib13742a; + +void clear() +{ + void foo() {} // nested function + performLocked!foo; // template from other module (preceding on command line) +} diff --git a/test/runnable/extra-files/test13742.d b/test/runnable/extra-files/test13742.d new file mode 100644 index 000000000000..3666bb24998a --- /dev/null +++ b/test/runnable/extra-files/test13742.d @@ -0,0 +1,6 @@ +import lib13742b; + +void main() +{ + clear(); +} diff --git a/test/runnable/test13742.sh b/test/runnable/test13742.sh new file mode 100755 index 000000000000..6a6ef8d38f40 --- /dev/null +++ b/test/runnable/test13742.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +set -x # debug windows issues +set -ueo pipefail + +src=runnable${SEP}extra-files +dir=${RESULTS_DIR}${SEP}runnable +output_file=${dir}/test13742.sh.out + +if [ $OS == "win32" -o $OS == "win64" ]; then + LIBEXT=.lib + OBJ=.obj +else + LIBEXT=.a + OBJ=.o +fi + +$DMD -m${MODEL} -I${src} -lib -cov -of${dir}${SEP}test13742${LIBEXT} ${src}${SEP}lib13742a.d ${src}${SEP}lib13742b.d +$DMD -m${MODEL} -I${src} -cov -of${dir}${SEP}test13742${EXE} ${src}${SEP}test13742.d ${dir}${SEP}test13742${LIBEXT} + +${RESULTS_DIR}/runnable/test13742${EXE} --DRT-covopt=dstpath:${dir}${SEP} + +rm ${RESULTS_DIR}/runnable/{runnable-extra-files-{lib13742a,lib13742b,test13742}.lst,test13742{${OBJ},${LIBEXT},${EXE}}} + +echo Success > ${output_file}