Skip to content

Commit 73a53de

Browse files
authored
Don't drop aggregate type qualifier for alias parameter (#22393)
Fixes #17959.
1 parent 6f03ad8 commit 73a53de

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

compiler/src/dmd/templatesem.d

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2778,7 +2778,9 @@ private MATCH matchArg(TemplateParameter tp, Scope* sc, RootObject oarg, size_t
27782778
if (!sa || si != sa)
27792779
return matchArgNoMatch();
27802780
}
2781-
dedtypes[i] = sa;
2781+
// Note: Dsymbol can't have type qualifiers, so use type if it has them
2782+
// https://github.com/dlang/dmd/issues/17959
2783+
dedtypes[i] = ta && ta.mod ? ta : sa;
27822784

27832785
if (psparam)
27842786
{
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
alias t(alias a) = a;
2+
3+
static assert(is(t!(const Object) == const Object));
4+
static assert(is(t!(shared(Object)) == shared Object));
5+
static assert(is(t!(immutable S) == immutable(S)));
6+
7+
struct S {}

0 commit comments

Comments
 (0)