http://d.puremagic.com/issues/show_bug.cgi?id=8074
Summary: template-mixin example contradicts text Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: websites AssignedTo: nob...@puremagic.com ReportedBy: tim.dolo...@gmail.com --- Comment #0 from Tim Smith <tim.dolo...@gmail.com> 2012-05-09 09:52:31 PDT --- The text says: "If two different mixins are put in the same scope, and each define a declaration with the same name, there is an ambiguity error when the declaration is referenced" However, the example *does* compile with no error, and runs the Bar.func() method. Here is the exact code I'm using: $ cat mix08.d import std.stdio, std.exception; /* If two different mixins are put in the same scope, and each define a declaration with the same name, there is an ambiguity error when the declaration is referenced: */ mixin template Foo() { int x = 5; void func(int x) { writeln("Foo.func(), x = ", x); } } mixin template Bar() { int x = 4; void func() { writeln("Bar.func(), x = ", x); } } mixin Foo; mixin Bar; void main() { //writefln("x = %d", x); // error, x is ambiguous /* The call to func() is ambiguous because Foo.func and Bar.func are in different scopes. */ func(); // error, func is ambiguous } $ dmd|grep DMD DMD64 D Compiler v2.059 $ dmd -w mix08.d $ ./mix08 Bar.func(), x = 4 $ I don't know if the text is wrong, or if DMD is wrong. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------