digitalmars.D.bugs - [Issue 5094] New: No implicit conversion with "alias property this"
- d-bugmail puremagic.com (35/35) Oct 21 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5094
- d-bugmail puremagic.com (11/11) Oct 21 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5094
- d-bugmail puremagic.com (12/12) Dec 06 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5094
http://d.puremagic.com/issues/show_bug.cgi?id=5094
Summary: No implicit conversion with "alias property this"
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody puremagic.com
ReportedBy: rsinfu gmail.com
---
Implicit conversion with help of alias this doesn't work if the aliased symbol
is a property (or just nullary) function. The following code doesn't compile:
--------------------
void main()
{
S s;
int[] conv = s; // (4)
}
struct S
{
property int[] get() { return [1,2,3]; }
alias get this;
}
--------------------
% dmd -o- -c test.d
test.d(4): Error: cannot implicitly convert expression (s) of type S to int[]
--------------------
The repro code compiles fine if 'get' is a variable.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 21 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5094 --- Created an attachment (id=789) Patch against dmd r725, fixes implicitConvTo() implicitConvTo() of TypeStruct and TypeClass don't deal with functions, and just tests convertion from function type to value type (then fails). The attached patch fixes the problem by adding a special check for functions. Passed dmd/druntime/phobos tests. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 21 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5094
Walter Bright <bugzilla digitalmars.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |bugzilla digitalmars.com
Resolution| |FIXED
00:20:04 PST ---
http://www.dsource.org/projects/dmd/changeset/786
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 06 2010









d-bugmail puremagic.com 