Feature request: __traits(canInstantiate), like __traits(compiles) but without suppressing syntax errors

FeepingCreature feepingcreature at gmail.com
Wed Jan 15 15:13:08 UTC 2020

Right now it's impossible to check "is there a valid (template) 
specialization for this function call" without also saying "and 
by the way, if there's a syntax error in the function, suppress 
the error and return false."

This makes many Phobos and library functions very annoying to use.

A simple (?) fix for this would be adding a new trait that checks 
if the expression resolves to a valid template specialization, 
without attempting to also check if the function body compiles, 
or else without suppressing internal syntax errors.

More information about the Digitalmars-d mailing list