Re: having a trivial anonymous function call in template prevents compilation?

2016-08-17 Thread Cauterite via Digitalmars-d-learn
On Wednesday, 17 August 2016 at 13:33:26 UTC, Steven Schveighoffer wrote: I think the OP's case is a bug. Please file. Thanks, I've filed it. Just wanted to get a second opinion before concluding that it's a bug.

Re: having a trivial anonymous function call in template prevents compilation?

2016-08-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/17/16 9:23 AM, Lodovico Giaretta wrote: On Wednesday, 17 August 2016 at 13:21:16 UTC, Cauterite wrote: On Wednesday, 17 August 2016 at 13:18:06 UTC, Adam D. Ruppe wrote: Best you can do is use them in an alias argument directly, but you cannot use them in an enum argument. I think you

Re: having a trivial anonymous function call in template prevents compilation?

2016-08-17 Thread Lodovico Giaretta via Digitalmars-d-learn
On Wednesday, 17 August 2016 at 13:21:16 UTC, Cauterite wrote: On Wednesday, 17 August 2016 at 13:18:06 UTC, Adam D. Ruppe wrote: Best you can do is use them in an alias argument directly, but you cannot use them in an enum argument. I think you missed the point; it works perfectly fine

Re: having a trivial anonymous function call in template prevents compilation?

2016-08-17 Thread Cauterite via Digitalmars-d-learn
On Wednesday, 17 August 2016 at 13:18:06 UTC, Adam D. Ruppe wrote: Best you can do is use them in an alias argument directly, but you cannot use them in an enum argument. I think you missed the point; it works perfectly fine without having this `({return 0;})()` in the template body (which,

Re: having a trivial anonymous function call in template prevents compilation?

2016-08-17 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 17 August 2016 at 13:09:40 UTC, Cauterite wrote: 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? Function pointers and delegates are not valid compile time

having a trivial anonymous function call in template prevents compilation?

2016-08-17 Thread Cauterite via Digitalmars-d-learn
// -- Example: -- template A(alias Arg) { enum A = Arg; enum Unrelated = ({return 0;})(); // this line prevent compilation }; void main() { enum FnPtr = enum _ = A!FnPtr; }; void asdf() {}; // ( https://dpaste.dzfl.pl/79301f12e5fc ) Just by having a