http://d.puremagic.com/issues/show_bug.cgi?id=3952



--- Comment #2 from bearophile_h...@eml.cc 2010-08-07 00:14:07 PDT ---
Andrei has asked if just a pragma(msg) is enough for the error template
constraints.

In some situations it works. But to use pragma(msg) you have to guard it with a
static if. So if the template constraint is a CTFE (that uses a normal 'if'
instead of a 'static if') you can't use it. While ctputs() can be used, this
shows the error message even if it's not required:

bool isGoodFoo(int x) {
    if (x > 10) {
        return true;
    } else {
        pragma(msg, "no good");
        // ctputs("no good");
        return false;
    }
}
void foo(int N)() if (isGoodFoo(N)) {
}
void main() {
    foo!(20)();
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to