Mixin bug / unhelpful behavior?

"Luís "Luís
Tue Apr 23 16:10:20 PDT 2013


Consider the following code:

     mixin template Bar()
     {
         void Bar() {};
     }

     void mixin_ok()
     {
         mixin Bar;
         Bar();
     }

     void mixin_not_defined_ok()
     {
         mixin UndefinedMixin; // OK, compile-time error
     }

     void mixin_not_defined_bug()()
     {
         mixin UndefinedMixin; // No error, unless 
mixin_not_defined_bug is called. Bug?
     }

     void mixin_alias()
     {
         alias Foo = Bar;
         mixin Foo;
         //Foo(); // error: template instance Bar!() mixin 
templates are not regular templates
         Bar(); // ok, but not very helpful
     }

Questions:

1) Is it a bug that mixin_not_defined_bug does not produce a 
compile-time error, unless it is called? (DMD64 v2.062, OS X)

2) Wouldn't it make be helpful if "Foo()" did the same thing as 
Bar()?


More information about the Digitalmars-d mailing list