way to warn about __traits(compiles , ...) that fail due to compile time interpretation lacking body ?
Nicholas Wilson via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Mar 21 18:50:13 PDT 2016
So I was recently trying to optimise a string substitution
function by reserving capacity. however this was being used at
compile time (mixin) and the body of arr.reserve(n) was not
available causing a bug that was easy to observe but very
difficult to determine why. As a result code was taking a wrong
static if branch. I know __traits(compiles, ... ) is a blunt tool
but it feels very wrong to have a function that works and
complies at runtime, fail to compile at compile time and not
receive any warning.
More information about the Digitalmars-d-learn
mailing list