D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7709 - Segfault when trying to use any property of an AA, which is the return type of a CTFE function with inout parameters.
Summary: Segfault when trying to use any property of an AA, which is the return type o...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: CTFE, ice
Depends on:
Blocks:
 
Reported: 2012-03-14 12:54 UTC by kennytm
Modified: 2012-04-30 15:25 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description kennytm 2012-03-14 12:54:59 UTC
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 Don 2012-03-15 03:13:51 UTC
Duplicate of bug 7602?
Comment 2 kennytm 2012-03-15 03:35:33 UTC
(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 Don 2012-03-30 06:31:43 UTC
Works now, on git head. I don't think this had anything to do with CTFE.
Comment 4 SomeDude 2012-04-21 06:50:05 UTC
Works with 2.059