d: Fix qualifier ignored in alias definition if parentheses are not present

Fixes regression where the qualifier was ignored in an alias definition
if parentheses were not present.

Reviewed-on: https://github.com/dlang/dmd/pull/12504

gcc/d/ChangeLog:

	* dmd/MERGE: Merge upstream dmd b7d146c4c.
This commit is contained in:
Iain Buclaw 2021-05-10 12:03:19 +02:00
parent 1f58114db8
commit cc1d563887
3 changed files with 13 additions and 3 deletions

View file

@ -1,4 +1,4 @@
0450061c8de71328815da9323bd35c92b37d51d2
b7d146c4c34469f876a63f26ff19091a7f9d54d7
The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository.

View file

@ -4880,8 +4880,11 @@ static void aliasInstanceSemantic(TemplateInstance *tempinst, Scope *sc, Templat
TemplateTypeParameter *ttp = (*tempdecl->parameters)[0]->isTemplateTypeParameter();
Type *ta = isType(tempinst->tdtypes[0]);
Declaration *d = new AliasDeclaration(tempinst->loc, ttp->ident, ta->addMod(tempdecl->onemember->isAliasDeclaration()->type->mod));
d->storage_class |= STCtemplateparameter;
AliasDeclaration *ad = tempdecl->onemember->isAliasDeclaration();
// Note: qualifiers can be in both 'ad.type.mod' and 'ad.storage_class'
Declaration *d = new AliasDeclaration(tempinst->loc, ttp->ident, ta->addMod(ad->type->mod));
d->storage_class |= STCtemplateparameter | ad->storage_class;
dsymbolSemantic(d, sc);
paramscope->pop();

View file

@ -0,0 +1,7 @@
// https://issues.dlang.org/show_bug.cgi?id=21898
alias Works(T) = immutable(T);
alias Fails(T) = immutable T;
static assert(is(Works!int == immutable int));
static assert(is(Fails!int == immutable int));