[Issue 14166] null dereference during CTFE

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Feb 10 07:28:23 PST 2015


https://issues.dlang.org/show_bug.cgi?id=14166

Vladimir Panteleev <thecybershadow at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thecybershadow at gmail.com

--- Comment #2 from Vladimir Panteleev <thecybershadow at gmail.com> ---
(In reply to Kenji Hara from comment #1)
> Is this really a regression? With 2.066.1 and, 2.066, same error happens.
> 
> And with 2.065, the error is changed to:

Sorry about that. This code compiles in 2.065 but not 2.066:

////////////// test.d /////////////
struct Proxy (T)
{
    T* ptr;

    ref deref ()
    {
        return *ptr;
    }

    alias deref this;
}

struct Test
{
    auto opIndex ()
    {
        return this;
    }
    auto opIndex (int)
    {
        return 1;
    }
}

template Elem (R)
{
    alias Elem = typeof(R.init[0]);
}

void main ()
{
    alias T = Proxy!Test;
    pragma (msg, Elem!T);
}
///////////////////////////////////

Introduced in https://github.com/D-Programming-Language/dmd/pull/3569

--


More information about the Digitalmars-d-bugs mailing list