Why does this work?

Mason McGill via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jun 23 02:31:01 PDT 2014


On Monday, 23 June 2014 at 09:29:15 UTC, Mason McGill wrote:
> Strange behavior, indeed. It took me a minute, but I think I 
> know what's going on, and I'm pretty sure it's a bug. D 
> recently introduced a short syntax for function-like templates:
>
>   enum a(b) = "some_value";
>
> It looks like this also (sort of) works with other qualifiers, 
> which I believe it shouldn't. Here's a minimal example that 
> might be good to put in a bug report:
>
>   void main() {
>       enum a(x) = "some_value"; // Good.
>       auto b(x) = "some_value"; // Huh?
>       // This also works for `const`, `static`, etc.
>   }

It looks like I'm mistaken. Variable templates are supposed to 
exist. Please ignore the previous post.


More information about the Digitalmars-d-learn mailing list