Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Issue 19857 - Name mangling mismatch when compiling with -dip1000 #9789

Merged
merged 1 commit into from May 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/dmd/semantic3.d
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
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
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`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That does not look good though. I'm all for the mangling change, but it shouldn't break the error message.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message was changed because DMD used different mangling (and thus function names) with -preview=dip1000

---
*/

Expand Down