digitalmars.D.bugs - [Issue 8434] New: [2.060 beta] cannot implicitly convert expression (vs1.opCast()) of type const(Vector2D) to object.Object
- d-bugmail puremagic.com (98/98) Jul 25 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8434
- d-bugmail puremagic.com (9/9) Jul 25 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8434
- d-bugmail puremagic.com (11/11) Jul 28 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8434
- Namespace (5/17) Jul 28 2012 I could swear that this code works on my desktop pc, but now on
- Namespace (4/4) Jul 28 2012 This works on 2.059 and even with 2.060.
- d-bugmail puremagic.com (15/15) Jul 28 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8434
- d-bugmail puremagic.com (22/29) Jul 28 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8434
- d-bugmail puremagic.com (15/15) Jul 28 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8434
- d-bugmail puremagic.com (11/11) Jul 28 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8434
- d-bugmail puremagic.com (10/10) Jul 28 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8434
http://d.puremagic.com/issues/show_bug.cgi?id=8434 Summary: [2.060 beta] cannot implicitly convert expression (vs1.opCast()) of type const(Vector2D) to object.Object Product: D Version: D2 Platform: x86_64 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: rswhite4 googlemail.com --- Comment #0 from rswhite4 googlemail.com 2012-07-25 07:29:16 PDT --- [code] import std.conv : to; class Vector2D(T) { public: T x, y; this(T x, T y) { this.x = x; this.y = y; } U opCast(U)() const { return new U(x, y); } } alias Vector2D!(short) Vector2s; alias Vector2D!(float) Vector2f; void main() { Vector2s vs1 = new Vector2s(42, 23); Vector2s vs2 = new Vector2s(42, 23); assert(vs1 == vs2); } [/code] prints: dmd -w -O -property -unittest -debug -of"vec_test_2060" "vec_test_2060.d" (im Verzeichnis: D:\D\D_Scripts\Test 4) vec_test_2060.d(13): Error: no constructor for Object vec_test_2060.d(24): Error: template instance vec_test_2060.Vector2D!(short).Vector2D.opCast!(Object) error instantiating Kompilierung fehlgeschlagen. And this code: [code] import std.conv : to; class Vector2D(T) { public: T x, y; this(T x, T y) { this.x = x; this.y = y; } U opCast(U : inout(Vector2D!V), V)() const { return new U(x, y); } } alias Vector2D!(short) Vector2s; alias Vector2D!(float) Vector2f; void main() { Vector2s vs1 = new Vector2s(42, 23); Vector2s vs2 = new Vector2s(42, 23); assert(vs1 == vs2); } [/code] prints: dmd -w -O -property -unittest -debug -of"vec_test_2060" "vec_test_2060.d" (im Verzeichnis: D:\D\D_Scripts\Test 4) vec_test_2060.d(24): Error: template instance opCast!(Object) opCast!(Object) does not match template declaration opCast(U : inout(Vector2D!(V)),V) vec_test_2060.d(24): Error: function expected before (), not vs1.opCast!(Object) of type void vec_test_2060.d(24): Error: template instance opCast!(Object) opCast!(Object) does not match template declaration opCast(U : inout(Vector2D!(V)),V) vec_test_2060.d(24): Error: function expected before (), not vs2.opCast!(Object) of type void Kompilierung fehlgeschlagen. If i add to the last code this: [code] const(U) opCast(U = typeof(this))() const { return this; } [/code] I get: dmd -w -O -property -unittest -debug -of"vec_test_2060" "vec_test_2060.d" (im Verzeichnis: D:\D\D_Scripts\Test 4) vec_test_2060.d(28): Error: cannot implicitly convert expression (vs1.opCast()) of type const(Object) to object.Object vec_test_2060.d(28): Error: cannot implicitly convert expression (vs2.opCast()) of type const(Object) to object.Object Kompilierung fehlgeschlagen. With 2.059 both works fine. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 25 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8434 Jonathan M Davis <jmdavisProg gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jmdavisProg gmx.com Severity|normal |regression -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 25 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8434 --- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2012-07-28 03:54:44 PDT --- Sorry, are these code really works in 2.059? As far as I know, there is a problem around equality comparison of class objects which have user-defined opCast. But the beginning of it (2011/08/09) is older than 2.059 (2012/04/12 released). And, I've tried to reproduce the problem, but in 2.059, same errors have occurred. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 28 2012
On Saturday, 28 July 2012 at 10:54:47 UTC, Kenji Hara wrote:http://d.puremagic.com/issues/show_bug.cgi?id=8434 --- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2012-07-28 03:54:44 PDT --- Sorry, are these code really works in 2.059? As far as I know, there is a problem around equality comparison of class objects which have user-defined opCast. But the beginning of it (2011/08/09) is older than 2.059 (2012/04/12 released). And, I've tried to reproduce the problem, but in 2.059, same errors have occurred.I could swear that this code works on my desktop pc, but now on my laptop it fails with 2.059 also. But i think that code should work, or? And are they any workarounds?
Jul 28 2012
This works on 2.059 and even with 2.060. http://dpaste.dzfl.pl/cd9c016c I will check tomorrow, why the other code compiles without errors on my desktop PC.
Jul 28 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8434 Mike Wey <mike-wey planet.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mike-wey planet.nl --- Comment #2 from Mike Wey <mike-wey planet.nl> 2012-07-28 04:39:44 PDT --- It's trying to call opCast!(Object) when comparing two objects. This "regression" was introduced with 2.058. But not everyone agrees it a regression: http://lists.puremagic.com/pipermail/dmd-beta/2012-February/001274.html and http://lists.puremagic.com/pipermail/dmd-beta/2012-February/001276.html -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 28 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8434 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull, rejects-valid Platform|x86_64 |All Summary|[2.060 beta] cannot |[Regression 2.058] cannot |implicitly convert |implicitly convert |expression (vs1.opCast()) |expression (vs1.opCast()) |of type const(Vector2D) to |of type const(Vector2D) to |object.Object |object.Object OS/Version|Windows |All --- Comment #3 from Kenji Hara <k.hara.pg gmail.com> 2012-07-28 08:56:25 PDT --- (In reply to comment #2)It's trying to call opCast!(Object) when comparing two objects. This "regression" was introduced with 2.058. But not everyone agrees it a regression: http://lists.puremagic.com/pipermail/dmd-beta/2012-February/001274.html and http://lists.puremagic.com/pipermail/dmd-beta/2012-February/001276.htmlWow, it had been reported in dmd-internal ML with 2.058 beta? I didn't noticed it. OK. I agree this is an actual regression, and it should be fixed as far as possible. https://github.com/D-Programming-Language/dmd/pull/1068 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 28 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8434 --- Comment #4 from github-bugzilla puremagic.com 2012-07-28 14:37:19 PDT --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/752f94c833bee38444340cff8186c9971388964f fix Issue 8434 - cannot implicitly convert expression (vs1.opCast()) of type const(Vector2D) to object.Object This is a regression of 2.058, by fixing issue 4088. The equality comparison of class objects should not run opCast. https://github.com/D-Programming-Language/dmd/commit/f3d5843fcb52600ddc0edcc2b04aa86ce48bfab1 Merge pull request #1068 from 9rnsr/fix8434 Issue 8434 - cannot implicitly convert expression (vs1.opCast()) of type const(Vector2D) to object.Object -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 28 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8434 --- Comment #5 from github-bugzilla puremagic.com 2012-07-28 22:23:33 PDT --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/9403491ee221977be396ac8f65748dce09eff2c6 fix test which added for issue 8434 https://github.com/D-Programming-Language/dmd/commit/5a9f538ca4b5cbebb726111f5290f6116e602d41 Merge pull request #1069 from 9rnsr/fix8434 fix test which added for issue 8434 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 28 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8434 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 28 2012