Bug 14552 – [REG2.066] SIGSEGV with compile construction nested class in predicate
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-05-07T09:39:00Z
Last change time
2015-06-17T21:05:32Z
Keywords
ice, pull
Assigned to
nobody
Creator
japplegame
Comments
Comment #0 by japplegame — 2015-05-07T09:39:53Z
DMD crashes (SIGSEGV) when compiles this code:
import std.algorithm : map;
class Outer {
auto test() {
return [1, 2, 3].map!( j => new Inner );
}
class Inner {}
}
If to change declaration Inner class to static, code compiles well.
DMD64 D Compiler v2.067.1
CentOS 7 x86_64
Comment #1 by dlang-bugzilla — 2015-05-07T14:26:24Z
Comment #2 by dlang-bugzilla — 2015-05-08T08:00:55Z
Reduced without Phobos:
////////////////// testNP.d //////////////////
template map(fun...)
{
template AppliedReturnType(alias f)
{
alias typeof(f(0)) AppliedReturnType;
}
auto map(int[] r)
{
assert(!is(AppliedReturnType!fun));
return MapResult!fun();
}
}
struct MapResult(alias fun)
{
@property front()
{
fun(0);
}
}
class Outer
{
auto test()
{
[1].map!( (j) { return new Inner; } );
}
class Inner {}
}
//////////////////////////////////////////////
Crashes as far back as this can compile.
Stops crashing after https://github.com/D-Programming-Language/dmd/pull/4464 (as before).
Jack: can you confirm that the bug is gone in your real program with D git?