Bug 3196 – Segfault(mtype.c) after almost any error involving a delegate literal
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2009-07-20T16:11:00Z
Last change time
2015-06-09T01:28:08Z
Keywords
ice-on-invalid-code
Assigned to
nobody
Creator
lifc0
Comments
Comment #0 by lifc0 — 2009-07-20T16:11:30Z
Try this on both linux and windows with dmd 2.031 give me a segment fault because of a null pointer reference.
struct Foo {
}
void foo (Foo b, void delegate ()) {
}
void main () {
foo(Foo(1), (){});
}
Comment #1 by clugdbug — 2009-08-05T01:01:53Z
Bug #3227 and bug #3228 are probably duplicates of this one.
Comment #2 by clugdbug — 2009-08-06T00:00:22Z
Original title:
"Bad struct declaration before a anonymous delegate within the parameter list show a segment fault" It's actually a lot more general than that. And it's a regression.
Another example from bug #3227:
auto x = (void){};
----
ice.d(1): Error: cannot have parameter of type void
ice.d(1): Error: cannot have parameter of type void
<segfault>
Other examples from bug #3228:
void main(){ (){}; (){}; }
ice.d(1): Error: function has no effect in expression (__dgliteral1)
<segfault>
This smiley variant should compile without errors. But it just segfaults.
---
static assert(!is(typeof((){(){}
;-()
{};})));
Comment #3 by clugdbug — 2009-08-06T00:00:57Z
*** Issue 3227 has been marked as a duplicate of this issue. ***
Comment #4 by clugdbug — 2009-08-06T00:01:17Z
*** Issue 3228 has been marked as a duplicate of this issue. ***