[Issue 8251] New: Property function call without parenthesis fails when it's passed as template argument

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jun 16 09:37:06 PDT 2012


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

           Summary: Property function call without parenthesis fails when
                    it's passed as template argument
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: tommitissari at hotmail.com


--- Comment #0 from Tommi <tommitissari at hotmail.com> 2012-06-16 09:39:21 PDT ---
template MyValue(int value)
{
    int MyValue = value;
}

struct MyStruct
{
    static @property int min()
    {
        return 123;
    }
}

@property int globalMin()
{
    return 456;
}

int main(string[] argv)
{
    static assert(MyStruct.min == 123); // #0: OK
    static assert(globalMin == 456);    // #1: OK
    int a = MyValue!(MyStruct.min());   // #2: OK
    int b = MyValue!(globalMin());      // #3: OK
    int c = MyValue!(MyStruct.min);     // #4
    int d = MyValue!(globalMin);        // #5
    return 0;
}

// #4: Error: template instance MyValue!(min) MyValue!(min)
// does not match template declaration MyValue(int value)

// #5: Error: template instance MyValue!(globalMin) MyValue!(globalMin)
// does not match template declaration MyValue(int value)

-- 
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