public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-660] d: Fix qualifier ignored in alias definition if parentheses are not present
@ 2021-05-10 10:19 Iain Buclaw
0 siblings, 0 replies; only message in thread
From: Iain Buclaw @ 2021-05-10 10:19 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:cc1d563887b1fe3183a21572b2ea63466b2bfa3a
commit r12-660-gcc1d563887b1fe3183a21572b2ea63466b2bfa3a
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date: Mon May 10 12:03:19 2021 +0200
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.
Diff:
---
gcc/d/dmd/MERGE | 2 +-
gcc/d/dmd/dsymbolsem.c | 7 +++++--
gcc/testsuite/gdc.test/compilable/test21898.d | 7 +++++++
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE
index 86fb308d759..d29d462f42f 100644
--- a/gcc/d/dmd/MERGE
+++ b/gcc/d/dmd/MERGE
@@ -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.
diff --git a/gcc/d/dmd/dsymbolsem.c b/gcc/d/dmd/dsymbolsem.c
index 33f74edf6ba..7a44ed2c41d 100644
--- a/gcc/d/dmd/dsymbolsem.c
+++ b/gcc/d/dmd/dsymbolsem.c
@@ -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();
diff --git a/gcc/testsuite/gdc.test/compilable/test21898.d b/gcc/testsuite/gdc.test/compilable/test21898.d
new file mode 100644
index 00000000000..9ac18b8cb6b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test21898.d
@@ -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));
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-10 10:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-10 10:19 [gcc r12-660] d: Fix qualifier ignored in alias definition if parentheses are not present Iain Buclaw
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).