[Issue 780] The assignment of 'this' is allowed

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Feb 27 08:47:39 PST 2007


http://d.puremagic.com/issues/show_bug.cgi?id=780





------- Comment #1 from thomas-dloop at kuehne.cn  2007-02-27 10:47 -------
http://www.digitalmars.com/d/class.html#constructors
# Constructors are defined with a function name of this and having no return 
value

However the compiler implements class constructors as returning the this
pointer
#
# module wood;
# class Tree{
#    this(){
#    }
# }
#

dmd -c wood.d && nm wood.o | grep _ctor | sed "s:.* ::"
_D4wood4Tree5_ctorMFZC4wood4Tree 

demangled: wood.Tree wood.Tree.this(this)


-- 



More information about the Digitalmars-d-bugs mailing list