using this instead of typeof(this)

Ivan Kazmenko gassa at mail.ru
Tue Feb 26 09:23:51 PST 2013


>> -----
>> 	this (ref this) // not a postblit constructor
>> 	this (ref this, this f, typeof (this), this, ref this g)
>> -----
>
> There was a discussion about this recently (wasn't it with 
> you?) and I believe the conclusion basically boiled down to 
> "bug: accepts-wrong".

Yeah, and the curiosity on "how does one call that this(ref this) 
constructor?" was what triggered me to try it further here.  But 
that thread resulted in another issue in Bugzilla (#9513), the 
"this(ref this)" case was just barely touched.  The thread: 
http://forum.dlang.org/thread/qhlsrpqajuwstvlspimf@forum.dlang.org?page=2#post-op.wsh3o4nqeav7ka:40stevens-macbook-pro.local

> Neither of those two signatures should compile. The fact that 
> they do is a bug.
>
> If they do compile, it's undefined behavior. From there, you 
> can't rely on anything.
>
> I think there was a bugzilla entry for it, but I'll have to 
> look for it.

After a quick search, I didn't find anything related to this(ref 
this) in Bugzilla.  Should I create an issue now?


More information about the Digitalmars-d-learn mailing list