Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
October 06, 2011 [Issue 6777] New: alias this + cast(void*) == bug | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=6777 Summary: alias this + cast(void*) == bug Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: dsimcha@yahoo.com --- Comment #0 from David Simcha <dsimcha@yahoo.com> 2011-10-06 11:43:25 PDT --- struct S {} class C { S s; alias s this; } void main() { auto c = new C; auto p = cast(void*) c; } test.d(10): Error: cannot cast from S to void* -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 23, 2011 [Issue 6777] alias this + cast(void*) == bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Simcha | http://d.puremagic.com/issues/show_bug.cgi?id=6777 --- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2011-10-23 05:09:22 PDT --- I think this is right behavior. In D2, the implicit conversion from class type to void* is disabled. So auto p = cast(void*) c; the expression c is transformed to c.s, and cause an error. ---- void main() { Object o; void* p = o; // test.d(4): Error: cannot implicitly convert expression (o) of type object.Object to void* } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 23, 2011 [Issue 6777] alias this + cast(void*) == bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Simcha | http://d.puremagic.com/issues/show_bug.cgi?id=6777 timon.gehr@gmx.ch changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |timon.gehr@gmx.ch --- Comment #2 from timon.gehr@gmx.ch 2011-10-23 08:04:47 PDT --- (In reply to comment #1) > I think this is right behavior. > In D2, the implicit conversion from class type to void* is disabled. So > > auto p = cast(void*) c; > > the expression c is transformed to c.s, and cause an error. > auto p = cast(void*) c; works if there is no alias this;. Implicit conversion rules are irrelevant, because this is an explicit conversion. Therefore, I think this is definitely a bug, because adding alias this should never disable features to work, it should only be considered if the code would not compile otherwise. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 14, 2012 [Issue 6777] alias this + cast(void*) == bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Simcha | http://d.puremagic.com/issues/show_bug.cgi?id=6777 Lukasz Wrzosek <luk.wrzosek@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason.james.house@gmail.com --- Comment #3 from Lukasz Wrzosek <luk.wrzosek@gmail.com> 2012-02-14 14:31:59 PST --- *** Issue 2929 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 05, 2013 [Issue 6777] alias this + cast(void*) == bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Simcha | http://d.puremagic.com/issues/show_bug.cgi?id=6777 Maksim Zholudev <maximzms@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |samukha@voliacable.com --- Comment #4 from Maksim Zholudev <maximzms@gmail.com> 2013-02-05 07:53:51 PST --- *** Issue 7985 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation