[Issue 1903] New: Template declaration (for mixin) can't be parsed

downs default_357-line at yahoo.de
Mon Mar 10 14:43:29 PDT 2008


d-bugmail at puremagic.com wrote:
> http://d.puremagic.com/issues/show_bug.cgi?id=1903
> 
>            Summary: Template declaration (for mixin) can't be parsed
>            Product: D
>            Version: 2.012
>           Platform: PC
>         OS/Version: Linux
>             Status: NEW
>           Severity: normal
>           Priority: P2
>          Component: DMD
>         AssignedTo: bugzilla at digitalmars.com
>         ReportedBy: webmaster at villagersonline.com
> 
> 
> DMD 2.012 Linux
> 
> The following code doesn't work, and if I understand correctly, it should:
> 
> BEGIN CODE
> 
>   void Foo(int a,int b) {}
>   template Bar(int x)
>   {
>     Foo(x,x);
>   }
>   void Baz()
>   {
>     mixin Bar!(1);
>   }
> 
> END CODE
> 
> 

The problem is that a template basically constitutes a namespace, not a scope. :)

So you can only put stuff in a template that you could also put at the global module level.

 --downs


More information about the Digitalmars-d-bugs mailing list