Skip to content

Commit

Permalink
Merge pull request #867 from donc/ctfe7770dollar
Browse files Browse the repository at this point in the history
Fix issue 7770 __dollar cannot be read at compile time
  • Loading branch information
WalterBright committed Apr 14, 2012
2 parents 14d64ec + 59ee1fa commit 4ff8864
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/dsymbol.c
Expand Up @@ -1398,6 +1398,7 @@ Dsymbol *ArrayScopeSymbol::search(Loc loc, Identifier *ident, int flags)
VoidInitializer *e = new VoidInitializer(0);
e->type = Type::tsize_t;
v->init = e;
v->storage_class |= STCctfe; // it's never a true static variable
}
*pvar = v;
}
Expand Down
24 changes: 24 additions & 0 deletions test/compilable/interpret3.d
Expand Up @@ -1209,6 +1209,30 @@ int sdfgasf()
}
static assert(sdfgasf() == 1);

/**************************************************
Bug 7770
**************************************************/

immutable char[] foo7770 = "abcde";

int bug7770a(string a)
{
return 1;
}

bool bug7770b(char c)
{
return true;
}

static assert( bug7770a(foo7770[0 .. $]));
static assert( bug7770b(foo7770[ $ - 2 ]));
void baz7770()
{
static assert( bug7770a(foo7770[0 .. $]));
static assert( bug7770b(foo7770[ $ - 2 ]));
}

/**************************************************
Bug 6015
**************************************************/
Expand Down

0 comments on commit 4ff8864

Please sign in to comment.