[dmd-internals] case hashOf(string literal) doesn't compile
Steven Schveighoffer via dmd-internals
dmd-internals at puremagic.com
Thu Jul 28 06:15:28 PDT 2016
> On Jul 27, 2016, at 12:57 AM, cy via dmd-internals <dmd-internals at puremagic.com> wrote:
>
> 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.
I think you have that backwards. “bar” is an immutable(char)[], which is a struct with a pointer and a size_t. Should be 16.
This may be a holdover from older compilers, when “bar” was actually typed as char[3]. Definitely seems like a bug in CTFE, please file.
Note, this compiles with latest released compiler, so it should be flagged a regression. I think the issue was there, but hashOf has gone through some changes recently for safety, so that probably uncovered the issue.
-Steve
More information about the dmd-internals
mailing list