[Issue 14883] static if does not work although an is expression produces 'true'

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Aug 7 08:55:02 PDT 2015


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

Martin Nowak <code at dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #3 from Martin Nowak <code at dawg.eu> ---
So this is an circular forward reference issue that cannot be resolved similar
to the following contradiction.

struct Foo
{
    static if (Foo.init.tupleof.length == 0)
        int anotherField;
}

You cannot access .init of a struct until all it's fields are known.
The IsExpression and __traits(compiles, ...) can be dangerous because they hide
all compiler errors.
Maybe we should make an exception for forward reference issues and do report
them even in speculative context?

--


More information about the Digitalmars-d-bugs mailing list