www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23277] New: alias to mixin template breaks selective


          Issue ID: 23277
           Summary: alias to mixin template breaks selective overriding of
                    mixin template member
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: destructionator gmail.com

Easier to describe in code:

interface A {
        void foo();
        void foo(int);

mixin template C(alias impl, Iface) {
        void foo(){ return impl.foo(); }
        void foo(int p){ return impl.foo(p); }

class B : A {
        A impl;
        mixin C!(impl, A) c;
        void foo(int) {}
        alias foo = c.foo;

Error: function `test.B.C!(impl, A).foo(int p)` conflicts with previous
declaration at test.d(14)

This pattern normally works to selectively override a function from the mixin
template, but the circular definition seems to trigger an order of semantic bug
or something.

Jul 30 2022