November 25, 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11601

           Summary: pragma(msg, ...) output not silenced inside
                    is(typeof()) and __traits(compiles, ...)
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: simen.kjaras@gmail.com


--- Comment #0 from Simen Kjaeraas <simen.kjaras@gmail.com> 2013-11-25 00:43:57 PST ---
void foo(T)() {
    static if (!is(T : int)) {
        pragma(msg, "Error message.");
    }
    static assert(is(T : int));
}

void main() {
    assert(!is(typeof(foo!string)));
}

The above program outputs "Error message." before concluding that the function could not be instantiated. In my use case, the pragma is used to tell the user exactly what he's doing wrong, and have absolutely no use when testing if the code compiles or not.

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