Bug 6295 – [Regression 2.054] Segfault in checkPurity() of template value parameter

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2011-07-12T09:47:00Z
Last change time
2011-08-01T21:45:25Z
Keywords
ice-on-valid-code, patch
Assigned to
nobody
Creator
puneet

Comments

Comment #0 by puneet — 2011-07-12T09:47:22Z
Here is a reduced test case. Compiles and runs fine with dmd-2.053, segfaults at compile stage for dmd 1.054. Compiles and runs fine with dmd-2.054 if I take out "size_t N" template parameter. Also compiles fine with 2.054 if printFoo is defined outside the main function. import std.stdio; struct Foo(IF, size_t N) {} interface Bar {} void main() { void printFoo(T: Foo!(IF, N), IF, size_t N)(T foo) if(is(IF == interface)) { writeln("Type: ", T.stringof); } Foo!(Bar, 1) foo; printFoo(foo); }
Comment #1 by bearophile_hugs — 2011-07-12T10:04:10Z
Simplified code: struct Foo(int N) {} void main() { void bar(T: Foo!(N), int N)(T) {} }
Comment #2 by kennytm — 2011-07-12T10:48:23Z
Comment #3 by bearophile_hugs — 2011-07-12T12:11:47Z
(In reply to comment #2) > DMD pull #242. > > https://github.com/D-Programming-Language/dmd/pull/242 That was fast :-) A limited form of typestate (see bug 4571 ) might help D user code avoid many null reference bugs.
Comment #4 by kennytm — 2011-07-12T12:17:33Z
(In reply to comment #3) > (In reply to comment #2) > > DMD pull #242. > > > > https://github.com/D-Programming-Language/dmd/pull/242 > > That was fast :-) > > A limited form of typestate (see bug 4571 ) might help D user code avoid many > null reference bugs. Typestates in D cannot help NULL dereferencing bugs in DMD which is written in C++.
Comment #5 by bugzilla — 2011-08-01T21:45:25Z