Getting the error from __traits(compiles, ...)
    Walter Bright 
    newshound1 at digitalmars.com
       
    Thu Nov 12 11:49:56 PST 2009
    
    
  
Bill Baxter wrote:
> Any other thoughts about how to get the failure info?   This is
> probably the main complaint against __traits(compiles), that there's
> no way to find out what went wrong if the code doesn't compile.  Often
> it can just be a typo.  I know I've spent plenty of time looking at
> static if(__traits(compiles, ...)) checks that weren't working only to
> discover I switched an x for a y somewhere.  Or passed the wrong
> number of arguments.
I agree it's a problem. Perhaps we can do:
    __traits(compiles_or_msg, ...)
which would print the error messages, at least making it easier to track 
down.
    
    
More information about the Digitalmars-d
mailing list