Bug in using string mixins inside of a struct?

Joseph Cassman jc7919 at outlook.com
Tue Mar 26 14:28:15 PDT 2013


I get these errors

aggregate.d(11): Error: variable aggregate.A.c!("y").c cannot use 
template to add field to aggregate 'A'
aggregate.d(6): Error: template instance aggregate.A.c!("y") 
error instantiating

from compiling the following code

struct A
{
     void b()
     {
         size_t y;
         mixin(c!("y"));
     }

     template c(string x)
     {
         const char[] c = "
             while(" ~ x ~ " < 100)
             {
                 " ~ x ~ "++;
             }";
     }
}

I can only find bug 276 
(http://d.puremagic.com/issues/show_bug.cgi?id=276) which seems 
related but looks like it was fixed.

I am using dmd 2.062 on Ubuntu Linux 12.10.

Is this a bug? Or maybe bad code?

Thanks

Joseph


More information about the Digitalmars-d mailing list