Permalink
Browse files

Fix issue 7770 __dollar cannot be read at compile time

It is always a CTFE variable, even if in global scope.
  • Loading branch information...
1 parent c2824d4 commit 59ee1fa13ff8f921bfe45307ea595fae7ea51fa7 @don-clugston-sociomantic don-clugston-sociomantic committed Apr 4, 2012
Showing with 25 additions and 0 deletions.
  1. +1 −0 src/dsymbol.c
  2. +24 −0 test/compilable/interpret3.d
View
@@ -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;
}
@@ -1210,6 +1210,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
**************************************************/

0 comments on commit 59ee1fa

Please sign in to comment.