[Issue 11522] mixing template mixins of template functions creates issues for dmd

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 9 13:57:17 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=11522

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1305 at gmail.com
         Resolution|---                         |INVALID

--- Comment #3 from RazvanN <razvan.nitu1305 at gmail.com> ---
This is the expected behavior. The innerMixin introduces a new scope so the
function that is constrainted to "toto" actually has priority over the function
constrained to "tata". To achieve what you want you have to introduce
innerMixin.someFunc in the same overload set as outerMixin.somefunc:

mixin template outerMixin() {


  mixin innerMixin im;
  alias somefunc = im.someFunc();

  //If you comment out this function, it compiles and work.
  void someFunc( string s )() if( s == "toto" ) {

  }
}

Then the code will compile.

--


More information about the Digitalmars-d-bugs mailing list