Skip to content

Commit

Permalink
fix Issue 19857 - Name mangling mismatch when compiling with -dip1000
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed May 14, 2019
1 parent 9585ab8 commit 9d3b0a7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/dmd/semantic3.d
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,8 @@ private extern(C++) final class Semantic3Visitor : Visitor
if (funcdecl.type == f)
f = cast(TypeFunction)f.copy();
f.isreturn = true;
if (funcdecl.storage_class & STC.returninferred)
f.isreturninferred = true;
}
}

Expand Down
18 changes: 18 additions & 0 deletions test/compilable/scopeinfer.d
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,21 @@ static assert(typeof(foo).mangleof == "FNaNbNiNfPvZi");
auto bar(void* p) { return p; }
static assert(typeof(bar).mangleof == "FNaNbNiNfPvZQd");

// https://issues.dlang.org/show_bug.cgi?id=19857

struct Stack()
{
@safe:
int** data;
ref int* top()
{
return *data;
}
}

alias S = Stack!();

//pragma(msg, S.top.mangleof);

version (Win32)
static assert(S.top.mangleof == "_D4test__T5StackZQh3topMFNaNbNcNiNfZPi");
8 changes: 4 additions & 4 deletions test/fail_compilation/retscope.d
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,10 @@ void* funretscope(scope dg_t ptr) @safe
/*
TEST_OUTPUT:
---
fail_compilation/retscope.d(249): Error: cannot implicitly convert expression `__lambda1` of type `void* delegate() pure nothrow @nogc return @safe` to `void* delegate() @safe`
fail_compilation/retscope.d(249): Error: cannot implicitly convert expression `__lambda1` of type `void* delegate() pure nothrow @nogc return @safe` to `void* delegate() @safe`
fail_compilation/retscope.d(250): Error: cannot implicitly convert expression `__lambda2` of type `void* delegate() pure nothrow @nogc return @safe` to `void* delegate() @safe`
fail_compilation/retscope.d(250): Error: cannot implicitly convert expression `__lambda2` of type `void* delegate() pure nothrow @nogc return @safe` to `void* delegate() @safe`
fail_compilation/retscope.d(249): Error: cannot implicitly convert expression `__lambda1` of type `void* delegate() pure nothrow @nogc @safe` to `void* delegate() @safe`
fail_compilation/retscope.d(249): Error: cannot implicitly convert expression `__lambda1` of type `void* delegate() pure nothrow @nogc @safe` to `void* delegate() @safe`
fail_compilation/retscope.d(250): Error: cannot implicitly convert expression `__lambda2` of type `void* delegate() pure nothrow @nogc @safe` to `void* delegate() @safe`
fail_compilation/retscope.d(250): Error: cannot implicitly convert expression `__lambda2` of type `void* delegate() pure nothrow @nogc @safe` to `void* delegate() @safe`
---
*/

Expand Down

0 comments on commit 9d3b0a7

Please sign in to comment.