Proposal: static template(fail)

Janice Caron caron800 at googlemail.com
Thu Dec 13 07:49:36 PST 2007


On 12/13/07, Aziz K. <aziz.kerim at gmail.com> wrote:
> Why not use a static assert: static assert(0, "Substitution Failure");

A static assert is a compile error. Different thing. What you want is
for the template not to be instanted, not for it to be instantiated
with a compile error.

Put it another way. Suppose you write

    S(int) s;

Which would you prefer - an error message saying that s couldn't be
instantiated (giving the filename and line number of the above line),
or an error message saying that a static assert in the middle of some
library file had been hit?



More information about the Digitalmars-d mailing list