www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 712] New: incorrect scope of class level mixins if interfaces are involved

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=712

           Summary: incorrect scope of class level mixins if interfaces are
                    involved
           Product: D
           Version: 0.177
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: thomas-dloop kuehne.cn


(Originally posted by John C <johnch_atms hotmail.com> on 2006-01-24
as news:dr4t3d$1f24$1 digitaldaemon.com)

#
# template T(){
#    void test(){
#       writefln("T.test");
#    }
# }
#
# interface I{
#    void test();
# }
#
# class C : I{
#    mixin T!();
#
#    void test(){
#       writefln("C.test");
#    }
# }
#
# void main(){
#    C c = new C();
#    c.test();
#    I i = new C();
#    i.test();
# }
#

output:
 C.test
 T.test

expected output:
 C.test
 C.test

http://www.digitalmars.com/d/mixin.html # # The declarations in a mixin are 'imported' into the surrounding scope. # If the name of a declaration in a mixin is the same as a declaration in # the surrounding scope, the surrounding declaration overrides the mixin one: # test cases: http://dstress.kuehne.cn/run/m/mixin_15_A.d http://dstress.kuehne.cn/run/m/mixin_15_B.d http://dstress.kuehne.cn/run/m/mixin_15_C.d --
Dec 22 2006
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=712


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei metalanguage.com
         AssignedTo|nobody puremagic.com        |bugzilla digitalmars.com


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 26 2010