[Issue 5363] const + alias this = wrong code
https://issues.dlang.org/show_bug.cgi?id=5363 Iain Buclaw changed: What|Removed |Added Priority|P2 |P1 --
[Issue 5363] const + alias this = wrong code
https://issues.dlang.org/show_bug.cgi?id=5363 Walter Bright changed: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=9274 --
[Issue 5363] const + alias this = wrong code
https://issues.dlang.org/show_bug.cgi?id=5363 calex changed: What|Removed |Added CC||calex+bugzilla-mail@aristow ||eb.net --
[Issue 5363] const + alias this = wrong code
https://issues.dlang.org/show_bug.cgi?id=5363 RazvanN changed: What|Removed |Added CC||razvan.nitu1...@gmail.com --- Comment #10 from RazvanN --- PR : https://github.com/dlang/dmd/pull/8810 --
[Issue 5363] const + alias this = wrong code
https://issues.dlang.org/show_bug.cgi?id=5363 --- Comment #9 from Walter Bright --- I simplified it a bit more, so it happens at compile time: struct S { int dummy; alias dummy this; } int foo(int){ return 1; } int foo(const(S)){ return 2; } void test() { static assert(foo(cast(const)S.init) == 2); // pass static assert(foo(S.init) == 2); // fail } Here's the trouble. With alias this, the conversion of S to int is considered an 'exact' match, while the conversion of S to const is considered a 'constant' match, which is not as good as 'exact'. Hence, the 'exact' is selected and foo(int) is called. The levels of conversion are: nomatch convert constant exact We could change an alias this conversion to a 'convert' match, but it is unknown how much breakage this will cause. It seems to be a rather drastic change. The compiler source code is the TypeStruct.implicitConvTo() function in mtype.d. --
[Issue 5363] const + alias this = wrong code
https://issues.dlang.org/show_bug.cgi?id=5363 Walter Bright changed: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=6777 --
[Issue 5363] const + alias this = wrong code
https://issues.dlang.org/show_bug.cgi?id=5363 RazvanN changed: What|Removed |Added CC||nilsboss...@googlemail.com --- Comment #8 from RazvanN --- *** Issue 9354 has been marked as a duplicate of this issue. *** --
[Issue 5363] const + alias this = wrong code
https://issues.dlang.org/show_bug.cgi?id=5363 taylorh...@gmail.com changed: What|Removed |Added CC||taylorh...@gmail.com --- Comment #7 from taylorh...@gmail.com --- Still fails on DMD 2.070.2 ( 2.070.2 ) http://dpaste.dzfl.pl/1da91ec34a86 --
[Issue 5363] const + alias this = wrong code
https://issues.dlang.org/show_bug.cgi?id=5363 Marc Schütz schue...@gmx.net changed: What|Removed |Added CC||schue...@gmx.net --- Comment #6 from Marc Schütz schue...@gmx.net --- Just tested with latest DMD git. Jens Mueller's example passes now, but the other ones still fail. --
[Issue 5363] const + alias this = wrong code
https://d.puremagic.com/issues/show_bug.cgi?id=5363 Kenji Hara k.hara...@gmail.com changed: What|Removed |Added CC||peter.alexander...@gmail.co ||m --- Comment #5 from Kenji Hara k.hara...@gmail.com 2014-02-09 23:10:13 PST --- *** Issue 12117 has been marked as a duplicate of this issue. *** -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5363] const + alias this = wrong code
http://d.puremagic.com/issues/show_bug.cgi?id=5363 SomeDude lovelyd...@mailmetrash.com changed: What|Removed |Added CC||lovelyd...@mailmetrash.com --- Comment #3 from SomeDude lovelyd...@mailmetrash.com 2012-04-22 09:30:41 PDT --- Bug still here in 2.059. Kenji, what happened to your pull ? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5363] const + alias this = wrong code
http://d.puremagic.com/issues/show_bug.cgi?id=5363 Kenji Hara k.hara...@gmail.com changed: What|Removed |Added Keywords||patch --- Comment #2 from Kenji Hara k.hara...@gmail.com 2011-07-14 04:31:02 PDT --- https://github.com/D-Programming-Language/dmd/pull/173 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5363] const + alias this = wrong code
http://d.puremagic.com/issues/show_bug.cgi?id=5363 Kenji Hara k.hara...@gmail.com changed: What|Removed |Added CC||k.hara...@gmail.com --- Comment #1 from Kenji Hara k.hara...@gmail.com 2011-06-21 19:36:13 PDT --- More simple case: struct S { int dummy; alias dummy this; } int foo(int){ return 1; } int foo(const(S)){ return 2; } void main() { S s; assert(foo(s) == 2); } It is the reason of this problem that the type matching levels through normal and alias this have same basis. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---