www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13333] New: Incorrect error ungagging during the resolution

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

          Issue ID: 13333
           Summary: Incorrect error ungagging during the resolution of
                    forward references
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: k.hara.pg gmail.com
            Blocks: 13300

By fixing issue 13204, this code should be allowed, but doesn't.

template AliasThisTypeOf(T)
{
    static assert(0, T.stringof);  // T.stringof is important
}

template StaticArrayTypeOf(T)
{
    static if (is(AliasThisTypeOf!T AT))
        alias X = StaticArrayTypeOf!AT;
    else
        alias X = T;

    static if (is(X : E[n], E, size_t n))
        alias StaticArrayTypeOf = X;
    else
        static assert(0, T.stringof~" is not a static array type");
}

enum bool isStaticArray(T) = is(StaticArrayTypeOf!T);

struct VaraiantN(T)
{
    static if (isStaticArray!T)
        ~this() { static assert(0); }
}

struct DummyScope
{
    alias A = VaraiantN!C;

    static class C
    {
        A entity;
    }
}

Blocking issue 13300.

--
Aug 19 2014