Skip to content

Commit

Permalink
Merge pull request #9789 from WalterBright/inferRetMangle
Browse files Browse the repository at this point in the history
fix Issue 19857 - Name mangling mismatch when compiling with -dip1000
merged-on-behalf-of: Jacob Carlborg <jacob-carlborg@users.noreply.github.com>
  • Loading branch information
dlang-bot committed May 14, 2019
2 parents 4ac1120 + 8007aa8 commit 021c674
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 @@ -1168,6 +1168,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 == "_D10scopeinfer__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 021c674

Please sign in to comment.