Skip to content

Commit

Permalink
fix Issue 13394 - invariant fail to link since 2.066 when using separ…
Browse files Browse the repository at this point in the history
…ate compilation
  • Loading branch information
9rnsr committed Aug 31, 2014
1 parent 2c13b63 commit 7683136
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/func.c
Expand Up @@ -1467,6 +1467,12 @@ void FuncDeclaration::semantic3(Scope *sc)
}
if (inv)
{
#if 1
// Workaround for bugzilla 13394: For the correct mangling,
// run attribute inference on inv if needed.
inv->functionSemantic();
#endif

//e = new DsymbolExp(Loc(), inv);
//e = new CallExp(Loc(), e);
//e = e->semantic(sc2);
Expand All @@ -1485,6 +1491,13 @@ void FuncDeclaration::semantic3(Scope *sc)
}
else
{
#if 1
// Workaround for bugzilla 13394: For the correct mangling,
// run attribute inference on inv if needed.
if (ad->isStructDeclaration() && ad->inv)
ad->inv->functionSemantic();
#endif

// Call invariant virtually
Expression *v = new ThisExp(Loc());
v->type = vthis->type;
Expand Down Expand Up @@ -1519,6 +1532,12 @@ void FuncDeclaration::semantic3(Scope *sc)
}
if (inv)
{
#if 1
// Workaround for bugzilla 13394: For the correct mangling,
// run attribute inference on inv if needed.
inv->functionSemantic();
#endif

//e = new DsymbolExp(Loc(), inv);
//e = new CallExp(Loc(), e);
//e = e->semantic(sc2);
Expand All @@ -1536,6 +1555,13 @@ void FuncDeclaration::semantic3(Scope *sc)
}
else
{
#if 1
// Workaround for bugzilla 13394: For the correct mangling,
// run attribute inference on inv if needed.
if (ad->isStructDeclaration() && ad->inv)
ad->inv->functionSemantic();
#endif

// Call invariant virtually
Expression *v = new ThisExp(Loc());
v->type = vthis->type;
Expand Down
24 changes: 24 additions & 0 deletions test/runnable/imports/link13394a.d
@@ -0,0 +1,24 @@
module imports.link13394a;

class A
{
this() { }
}

class Btpl(T) : T
{
this()() { }

invariant() {}
}

alias B = Btpl!A;

struct Stpl()
{
void func()() {}

invariant() {}
}

alias S = Stpl!();
13 changes: 13 additions & 0 deletions test/runnable/link13394.d
@@ -0,0 +1,13 @@
// COMPILE_SEPARATELY
// EXTRA_SOURCES: imports/link13394a.d

module link13394;
import imports.link13394a;

void main()
{
auto b = new B();

auto s = S();
s.func();
}

0 comments on commit 7683136

Please sign in to comment.