Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 59ee1fa13ff8f921bfe45307ea595fae7ea51fa7 1 parent c2824d4
@don-clugston-sociomantic don-clugston-sociomantic authored
Showing with 25 additions and 0 deletions.
  1. +1 −0  src/dsymbol.c
  2. +24 −0 test/compilable/interpret3.d
View
1  src/dsymbol.c
@@ -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;
}
View
24 test/compilable/interpret3.d
@@ -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
**************************************************/
Please sign in to comment.
Something went wrong with that request. Please try again.