Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/stable' into merge_stable
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinNowak committed Aug 10, 2015
2 parents bd860c6 + 2421415 commit c5dba46
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/parse.c
Expand Up @@ -431,6 +431,9 @@ Dsymbols *Parser::parseDeclDefs(int once, Dsymbol **pLastDecl, PrefixAttributes
}
break;
}
// Workaround 14894. Add an empty unittest declaration to keep
// the number of symbols in this scope independent of -unittest.
s = new UnitTestDeclaration(loc, token.loc, STCundefined, NULL);
}
break;

Expand Down
15 changes: 15 additions & 0 deletions test/compilable/extra-files/test14894a.d
@@ -0,0 +1,15 @@
module imports.test14894a;

mixin template Protocol()
{
void onReceive() {}
}

struct Foo
{
mixin Protocol!();

unittest
{
}
}
7 changes: 7 additions & 0 deletions test/compilable/extra-files/test14894main.d
@@ -0,0 +1,7 @@
import test14894a;

void main()
{
Foo foo;
foo.onReceive();
}
13 changes: 13 additions & 0 deletions test/compilable/test14894.sh
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

name=`basename $0 .sh`
dir=${RESULTS_DIR}/compilable
src=compilable/extra-files

$DMD -c -m${MODEL} -of${dir}/${name}a${OBJ} -I${src} ${src}/${name}a.d || exit 1

$DMD -unittest -m${MODEL} -od${dir} -I${src} ${src}/${name}main.d ${dir}/${name}a${OBJ} || exit 1

rm -f ${dir}/{${name}a${OBJ} ${name}main${EXE} ${name}main${OBJ}}

echo Success >${dir}/`basename $0`.out

0 comments on commit c5dba46

Please sign in to comment.