www.digitalmars.com         C & C++   DMDScript  

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


           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() {

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: -------
Nov 25 2013