[Issue 11601] New: pragma(msg, ...) output not silenced inside is(typeof()) and __traits(compiles, ...)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 25 00:43:58 PST 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 at puremagic.com
        ReportedBy: simen.kjaras at gmail.com


--- Comment #0 from Simen Kjaeraas <simen.kjaras at 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: -------


More information about the Digitalmars-d-bugs mailing list