[Issue 5426] New: Property syntax fails with template function with template paramters but no function parameters and you have a setter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jan 7 22:29:42 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5426

           Summary: Property syntax fails with template function with
                    template paramters but no function parameters and you
                    have a setter
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: jmdavisProg at gmx.com


--- Comment #0 from Jonathan M Davis <jmdavisProg at gmx.com> 2011-01-07 22:27:24 PST ---
This fails to compile:

struct S
{
    @property T func(T)()
    {
        return T.init;
    }

    @property void func(T)(T value)
    {
    }
}

void main()
{
    S s;
    auto t = s.func!int;
    s.func!int = 2;
}

and it gives this error:

l.d(16): Error: template instance func!(int) matches more than one template
declaration, l.d(3):func(T) and l.d(8):func(T)


If you use s.func!int(), it works. If you make it so that the setter function
is no longer a property function, and you don't actually try and use the
setter, then it works (though if you the try and use the non-property setter
function, the property getter fails again). So, it looks like the property
syntax is definitely broken for template which have a template parameter but no
function parameter. This is likely related to bug# 5425, though I'm not at all
sure that they're the same bug (since 5425 deals with a situation which works
normally but not inside __traits).

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


More information about the Digitalmars-d-bugs mailing list