Skip to content

Commit

Permalink
Merge pull request #1253 from 9rnsr/fix8942
Browse files Browse the repository at this point in the history
Issue 8942 - `alias <qualifier> <type>` ignores <qualifier> in foreach over tuple
  • Loading branch information
WalterBright committed Nov 8, 2012
2 parents e9d55f1 + 4b2423e commit f75f4c1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/declaration.c
Expand Up @@ -441,6 +441,7 @@ Dsymbol *AliasDeclaration::syntaxCopy(Dsymbol *s)
sa = new AliasDeclaration(loc, ident, type->syntaxCopy());
else
sa = new AliasDeclaration(loc, ident, aliassym->syntaxCopy(NULL));
sa->storage_class = storage_class;

// Syntax copy for header file
if (!htype) // Don't overwrite original
Expand Down
24 changes: 24 additions & 0 deletions test/runnable/declaration.d
Expand Up @@ -103,6 +103,29 @@ void test8410()
Foo[5] a2 = { s: "hello" }; // error
}

/***************************************************/
// 8942

alias const int A8942_0;
static assert(is(A8942_0 == const int)); // passes

void test8942()
{
alias const int A8942_1;
static assert(is(A8942_1 == const int)); // passes

static struct S { int i; }
foreach (Unused; typeof(S.tupleof))
{
alias const(int) A8942_2;
static assert(is(A8942_2 == const int)); // also passes

alias const int A8942_3;
static assert(is(A8942_3 == const int)); // fails
// Error: static assert (is(int == const(int))) is false
}
}

/***************************************************/

int main()
Expand All @@ -112,6 +135,7 @@ int main()
test8123();
test8147();
test8410();
test8942();

printf("Success\n");
return 0;
Expand Down

0 comments on commit f75f4c1

Please sign in to comment.