[dmd-internals] case hashOf(string literal) doesn't compile
cy via dmd-internals
dmd-internals at puremagic.com
Tue Jul 26 21:57:26 PDT 2016
void main() {
pragma(msg,"bar".sizeof);
size_t foo = 12;
switch(foo) {
case hashOf("bar"):
break;
}
}
I'm pretty sure this worked before. (htmld is full of these hash
case statements.) But now, when I try to compile, it spits out
errors like
druntime/import/object.d(3173): Error: pointer slice [0..16]
exceeds allocated memory block [0..3]
druntime/import/object.d(3173): called from here: hashOf(&
arg[0..16], seed)
test.d(5): called from here: hashOf("bar", 0LU)
I'm not sure, but I think "bar".sizeof is supposed to evaluate to
3 at compile time, rather than 16 regardless of the string's
length.
More information about the dmd-internals
mailing list