Thread overview | ||||||
---|---|---|---|---|---|---|
|
April 02, 2012 [Issue 7808] New: Nullable's alias this does not work with structs containing classes | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=7808 Summary: Nullable's alias this does not work with structs containing classes Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Severity: regression Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: jmdavisProg@gmx.com --- Comment #0 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-04-01 22:18:58 PDT --- This code compiled just fine with 2.058 import std.typecons; void main() { auto s = Nullable!S(S(new C)); func(s); } class C { } struct S { C c; this(C c) { this.c = c; } } void func(S s) { } But it fails to compile with the latest dmd, giving the error q.d(6): Error: function q.func (S s) is not callable using argument types (Nullable!(S)) q.d(6): Error: cannot implicitly convert expression (s) of type Nullable!(S) to S It works if the member variable is an int or string. It works if the member variable is a struct type which does _not_ have a class as a member variable. But if the struct has a member variable which is a class, or it has a member variable which is a struct which has a member variable which is a class, then it fails. Nullable!S' alias this should convert it to an S when passed to func, but it doesn't when S contains a member variable which is a class - either directly or indirectly. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 02, 2012 [Issue 7808] Nullable's alias this does not work with structs containing classes | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | http://d.puremagic.com/issues/show_bug.cgi?id=7808 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull, rejects-valid --- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2012-04-02 04:02:48 PDT --- https://github.com/D-Programming-Language/dmd/pull/857 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 05, 2012 [Issue 7808] Nullable's alias this does not work with structs containing classes | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | http://d.puremagic.com/issues/show_bug.cgi?id=7808 --- Comment #2 from github-bugzilla@puremagic.com 2012-04-05 10:54:30 PDT --- Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/b90543ea6d93aec7963004261e8fa749b0bdbf35 Merge pull request #857 from 9rnsr/fix7808 Issue 7808 - Nullable's alias this does not work with structs containing classes -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 05, 2012 [Issue 7808] Nullable's alias this does not work with structs containing classes | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | http://d.puremagic.com/issues/show_bug.cgi?id=7808 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: ------- |
Copyright © 1999-2021 by the D Language Foundation