www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14290] New: is-expression accepts instantiation of already

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

          Issue ID: 14290
           Summary: is-expression accepts instantiation of already
                    instantiated template
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: schuetzm gmx.net

This compiles:

    struct Foo(int i) {}
    alias Foo1 = Foo!1;
    static assert(is(Foo!2 == Foo1!T, T...));

Foo1 is clearly not a template, therefore the is-expression should fail.
(The alias is needed for syntactic reasons.)

Discovered by Nicolas Sicard:
http://forum.dlang.org/post/jsofxhqbdoupzbfdhxxe forum.dlang.org

--
Mar 15 2015