__traits(compiles, ...) with syntax errors

Steven Schveighoffer schveiguy at gmail.com
Mon Jan 14 21:53:53 UTC 2019


On 1/14/19 4:52 PM, Steven Schveighoffer wrote:
> Another option is to have __traits(compiles) spit out an error type that 
> has truthiness if it's not an error (for backwards compatibility), then 
> you could something like:
> 
> if(__traits(compiles, ...) != COMPILER_ERROR.SYNTAX)

Oops, it would have to be success or syntax error, so something like:

if(successOrSyntaxError!(__traits(compiles, ...)))

successOrSyntaxError would be a simple template

-Steve



More information about the Digitalmars-d mailing list