digitalmars.D.bugs - [Issue 12424] New: Cannot do qualifier-overload with mixin template.
- d-bugmail puremagic.com (49/49) Mar 20 2014 https://d.puremagic.com/issues/show_bug.cgi?id=12424
https://d.puremagic.com/issues/show_bug.cgi?id=12424 Summary: Cannot do qualifier-overload with mixin template. Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: monarchdodra gmail.com I'm trying to use a mixin template to insert const/non-const functions into my struct. They have the same signature, save for the const qualifier. The mixins work correctly, inserting the functions. However, the compiler complains of conflicts, instead of recognizing a qualified-overload. The mutable one should take precedence over the non-mutable one: That's the standard lookup rules. //---- mixin template fooMixin(T) { void foo() //L.3 {}; } struct S { //insert "void foo()" mixin fooMixin!int; //insert "void foo() const" const mixin fooMixin!int; } void main() { const(S) sc; S s; sc.foo(); //OK s.foo(); //FAILS L.22 } //---- main.d(22): Error: main.S.fooMixin!int.foo at main.d(3) conflicts with main.S.fooMixin!int.foo at main.d(3) //---- I need to use this approach, because inout doesn't actually work for me here, as the return type depends on how "this" is qualified. See: https://d.puremagic.com/issues/show_bug.cgi?id=12408 -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 20 2014