Bug 16320 – DMD segfault T.classinfo.hashOf

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-07-25T12:56:00Z
Last change time
2016-07-25T17:39:54Z
Keywords
ice
Assigned to
nobody
Creator
cauterite

Comments

Comment #0 by cauterite — 2016-07-25T12:56:52Z
https://dpaste.dzfl.pl/082f070327f5 import std.stdio; class T {}; void main() { T foo; switch (typeid(foo).hashOf) { case T.classinfo.hashOf : writeln(`foo isa T`); break; default : break; }; }; segfault with DMD v2.071.1
Comment #1 by cauterite — 2016-07-25T13:12:20Z
actually this is a much better example: https://dpaste.dzfl.pl/01e323e77dac class T {}; enum x = T.classinfo.hashOf;
Comment #2 by ketmar — 2016-07-25T13:57:02Z
seems to be fixed in master. confirm anyone?
Comment #3 by ag0aep6g — 2016-07-25T15:10:41Z
(In reply to Cauterite from comment #1) > actually this is a much better example: > https://dpaste.dzfl.pl/01e323e77dac > > class T {}; > enum x = T.classinfo.hashOf; (In reply to Ketmar Dark from comment #2) > seems to be fixed in master. confirm anyone? Can confirm. 2.071.1 segfaults. Git head (v2.072.0-devel-b0bc2f4) doesn't segfault, but prints an error: "object.d(3173): Error: pointer & arg cannot be sliced at compile time (it does not point to an array)".
Comment #4 by ketmar — 2016-07-25T15:12:32Z
yes, error is expected, as you can't do pointer math in CTFE. thank you.
Comment #5 by cauterite — 2016-07-25T17:39:54Z
Thanks Ket and anonymous.