D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 10840 - [CTFE] *this._data.arr is not yet implemented at compile time
Summary: [CTFE] *this._data.arr is not yet implemented at compile time
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
Depends on:
Blocks:
 
Reported: 2013-08-17 14:54 UTC by Dmitry Olshansky
Modified: 2013-08-29 06:14 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 Dmitry Olshansky 2013-08-17 14:54:39 UTC
Found while working on std.regex. std.array.Append will sometimes fail with that message.

Simpified test case:

bool empty(int[] arr)
{
    return arr.length == 0;
}

struct Appender
{
    private struct Data
    {
        size_t capacity;
        int[] arr;
    }

    private Data* _data;

    @property int[] data()  @trusted pure nothrow
    {
        return (_data ? _data.arr : null);
    }
}

struct Stack
{
    Appender stack;  
    @property bool empty(){ return stack.data.empty; }
}


bool foo()
{
    Stack app;
    return app.empty;
}


pragma(msg, foo());

Outputs (tested with git HEAD 2.064):

ctfe_fail.d(18): Error: *this._data.arr is not yet implemented at compile time
ctfe_fail.d(25):        called from here: this.stack.data()
ctfe_fail.d(25):        called from here: empty(this.stack.data())
ctfe_fail.d(32):        called from here: app.empty()
ctfe_fail.d(36):        called from here: foo()
ctfe_fail.d(36):        while evaluating pragma(msg, foo())
Comment 1 github-bugzilla 2013-08-21 04:38:39 UTC
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/5bacc3c1a6c1e380bc3be96c0d3d706d9c2cd870
Fix issue 10840 CTFE *this._data.arr is not yet implemented

This is a wrong-code bug in ?:, and a failure to detect null pointers
in DotVar expressions.