Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/dmd/expressionsem.d
Original file line number Diff line number Diff line change
Expand Up @@ -1912,7 +1912,8 @@ private bool functionParameters(const ref Loc loc, Scope* sc,
: p.type;

const hasCopyCtor = (arg.type.ty == Tstruct) && (cast(TypeStruct)arg.type).sym.hasCopyCtor;
if (!(hasCopyCtor || tprm.equals(arg.type)))
const typesMatch = arg.type.mutableOf().unSharedOf().equals(tprm.mutableOf().unSharedOf());
if (!((hasCopyCtor && typesMatch) || tprm.equals(arg.type)))
{
//printf("arg.type = %s, p.type = %s\n", arg.type.toChars(), p.type.toChars());
arg = arg.implicitCastTo(sc, tprm);
Expand Down
27 changes: 27 additions & 0 deletions test/runnable/test20025.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// https://issues.dlang.org/show_bug.cgi?id=20025
/*
TEST_OUTPUT:
---
---
*/

struct B
{
static int value = 77;
Copy link
Contributor

Choose a reason for hiding this comment

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

Indentation looks too deep.

alias value this;

this(ref return scope inout B rhs) inout { }
}

void test(int x)
{
assert(x == 77);
}

int main()
{
B b;
test(b);

return 0;
}