[Issue 6602] New: Invalid template instantiations »leaked« by is(typeof())/__traits(compiles, …)/Type::trySemantic

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Sep 4 21:29:36 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6602

           Summary: Invalid template instantiations »leaked« by
                    is(typeof())/__traits(compiles, …)/Type::trySemantic
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: code at klickverbot.at


--- Comment #0 from klickverbot <code at klickverbot.at> 2011-09-04 21:29:25 PDT ---
Okay, turns out that the »collateral regression« the fix for bug 6220 caused in
my code ([1]) really is a fundamental problem with how DMD handles template
instantiations in the face of error gagging, in this case because is(typeof())
is used (same for __traits(compiles, …)):

---
template A(T) {
  B!(T).Result result;
}

template B(U) {
  static assert(is(U == int));
  alias bool Result;
}

pragma(msg, is(typeof(A!short)));
---

The static assert in B!() should just cause is(typeof()) to evaluate to false,
but B!short is also added to the module member list, causing compilation to
fail because of !is(short == int).

I am working on a fix, but need an issue number to reference.


[1]
https://github.com/D-Programming-Language/dmd/commit/60f4ec88decbcd00e765ab392bf8be8f526ed1ab#commitcomment-535706

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list