Thread overview
[Issue 8245] New: UFCS doesn't work for pointers
Jun 14, 2012
dawg@dawgfoto.de
Apr 19, 2013
Denis Shelomovskij
Apr 19, 2013
Kenji Hara
Apr 23, 2013
Kenji Hara
June 14, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8245

           Summary: UFCS doesn't work for pointers
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: dawg@dawgfoto.de


--- Comment #0 from dawg@dawgfoto.de 2012-06-14 12:04:01 PDT ---
cat > bug.d << CODE
string toStr(immutable(char)* p)
{
    return null;
}

void main()
{
    immutable(char)* p = "foobar".ptr;
    p.toStr();
}
CODE

dmd -c bug
Error: no property 'toStr' for type 'immutable(char)'
----

Property resolution is only attempted on the dereferenced value.

IIUC we'd need to do 4 lookups.

- intrinsic properties
- properties of dereferenced value
- ufcs of value
- ufcs of dereferenced value (bug 8213)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 19, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8245


Denis Shelomovskij <verylonglogin.reg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unspecified                 |D2


--- Comment #1 from Denis Shelomovskij <verylonglogin.reg@gmail.com> 2013-04-19 12:21:44 MSD ---
Code from description compiles fine now.

But it still fails for properties:
---
@property string asStr(immutable(char)* p)
{ return null; }

void main()
{
    immutable(char)* p = "foobar".ptr;
    p.asStr; // Error: no property 'asStr' for type 'immutable(char)'
}
---

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 19, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8245


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid


--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2013-04-19 02:18:12 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1911

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 23, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8245



--- Comment #3 from github-bugzilla@puremagic.com 2013-04-22 23:55:48 PDT ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/508239985de8e6cab91bc1855a33e162f3c96a1b fix Issue 8245 - UFCS doesn't work for pointers

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 23, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8245


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------