Skip to content
Closed
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
1 change: 1 addition & 0 deletions src/dmd/globals.d
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ enum MATCH : int
{
nomatch, // no match
convert, // match with conversions
shared_, // match with conversion to shared
constant, // match with conversion to const
exact, // exact match
}
Expand Down
6 changes: 5 additions & 1 deletion src/dmd/mtype.d
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ bool MODimplicitConv(MOD modfrom, MOD modto) pure nothrow @nogc @safe
case X(MODFlags.wild, MODFlags.const_):
case X(MODFlags.wild, MODFlags.wildconst):
case X(MODFlags.wildconst, MODFlags.const_):
return (modfrom & MODFlags.shared_) == (modto & MODFlags.shared_);
// Casting to shared is fine, but otherwise casting from shared is not.
return (modto & MODFlags.shared_) || !(modfrom & MODFlags.shared_);

case X(MODFlags.immutable_, MODFlags.const_):
case X(MODFlags.immutable_, MODFlags.wildconst):
Expand Down Expand Up @@ -116,6 +117,9 @@ MATCH MODmethodConv(MOD modfrom, MOD modto) pure nothrow @nogc @safe
case X(MODFlags.shared_ | MODFlags.wildconst, MODFlags.shared_ | MODFlags.wild):
return MATCH.constant;

case X(0,MODFlags.shared_):
return MATCH.shared_;

default:
return MATCH.nomatch;
}
Expand Down