having a trivial anonymous function call in template prevents compilation?
Cauterite via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Aug 17 06:09:40 PDT 2016
// ------ Example: ----------
template A(alias Arg) {
enum A = Arg;
enum Unrelated = ({return 0;})(); // this line prevent
compilation
};
void main() {
enum FnPtr = &asdf;
enum _ = A!FnPtr;
};
void asdf() {};
// ( https://dpaste.dzfl.pl/79301f12e5fc )
Just by having a random `({return 0;})()` in the template body,
suddenly the template rejects its arguments. I'm so confused, is
this a bug? Or am I missing something?
More information about the Digitalmars-d-learn
mailing list