Bug 7709 – Segfault when trying to use any property of an AA, which is the return type of a CTFE function with inout parameters.
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-03-14T12:54:00Z
Last change time
2012-04-30T15:25:58Z
Keywords
CTFE, ice
Assigned to
nobody
Creator
kennytm
Comments
Comment #0 by kennytm — 2012-03-14T12:54:59Z
Test case 1 (expected compilable):
--------------------------------------------
inout(int[int]) test7709a(inout(int) bb) {
int[int] r;
r.keys;
return null;
}
static assert(null == test7709a(2));
--------------------------------------------
Test case 2 (expected failure):
--------------------------------------------
inout(int[int]) test7709b(inout(int) bb) {
int[int] r;
r.sadjalsdjasldjasjs;
return null;
}
static assert(null == test7709b(2));
--------------------------------------------
Both test cases cause segfault at template.c:4428 (TemplateInstance::semantic) because 'sc' is null.
Comment #1 by clugdbug — 2012-03-15T03:13:51Z
Duplicate of bug 7602?
Comment #2 by kennytm — 2012-03-15T03:35:33Z
(In reply to comment #1)
> Duplicate of bug 7602?
I don't think so (at least on the surface). This variant of 7602 works (as described in 7602's title):
--------------------------------------
string[] test7602b()
{
int[string] array = ["2": 3];
return array.keys;
}
enum str = test();
--------------------------------------
But this variant of 7709 fails:
--------------------------------------
inout(int[int]) test7709c(inout(int) bb)
{
int[int] arr = [1: 2];
arr.keys;
return null;
}
enum str = test7709c(2);
--------------------------------------
Comment #3 by clugdbug — 2012-03-30T06:31:43Z
Works now, on git head. I don't think this had anything to do with CTFE.