D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7424 - Segfault when trying to call a templated property with different const-ancy.
Summary: Segfault when trying to call a templated property with different const-ancy.
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 regression
Assignee: No Owner
URL:
Keywords: ice, pull
Depends on:
Blocks:
 
Reported: 2012-02-02 09:45 UTC by kennytm
Modified: 2012-02-06 00:39 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description kennytm 2012-02-02 09:45:27 UTC
Test case:

-----------------
struct S7424
{
    @property inout(int) g()() inout
    {
        return 0;
    }
    void test()
    {
        int f = g;
    }
}
-----------------

The @property is optional. Compile with 'dmd -c bug7424.d'.

The expression 'this.g()' has a NULL 'type', so the statement at expression.c:10112

	    Type *t2 = e2->type->toBasetype();

caused SEGFAULT.

The regression is introduced in commit 1d4438f151143fcdcb807e257959dd1d588f9048.
Comment 1 kennytm 2012-02-05 13:55:34 UTC
Further test cases:

--------------------------------------------------
// Should compile:
struct S7424a
{
    @property inout(int) g()() inout { return 0; }
    void test1() { int f = g; }
    void test2() const { int f = g; }
    void test3() immutable { int f = g; }
}
--------------------------------------------------
// Should fail:
struct S7424b
{
    @property int g()() { return 0; }
    void test() const { int f = g; }
}

struct S7424c
{
    @property int g()() { return 0; }
    void test() immutable { int f = g; }
}

struct S7424d
{
    @property int g()() immutable { return 0; }
    void test() const { int f = g; }
}

struct S7424e
{
    @property int g()() immutable { return 0; }
    void test() { int f = g; }
}

struct S7424f
{
    @property int g()() shared { return 0; }
    void test() { int f = g; }
}

struct S7424g
{
    @property int g()() { return 0; }
    void test() shared { int f = g; }
}
--------------------------------------------------
Comment 2 kennytm 2012-02-05 15:01:11 UTC
Pull #698.

https://github.com/D-Programming-Language/dmd/pull/698