Assert compilation failure with certain message

Tomek Sowiński just at ask.me
Thu Feb 10 16:39:46 PST 2011


bearophile napisał:

> > Is there a way to statically assert compilation of an expression failed *with a certain message*? I want to check
> > my static asserts trip when they should.  
> 
> I have asked something like this a lot of time ago, but I don't know a way to do it. You are able to statically
> assert that some code doesn't compile, but I don't know how to assert that a certain message gets produced. You are
> asking for a specific static catch :-)

Static catch, yeah. But I'd be content with traits__(fails, expr, msg) which seems tractable.

-- 
Tomek



More information about the Digitalmars-d-learn mailing list