[Issue 5425] New: __traits(compiles, ...) fails when given a template property function without parens

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jan 7 21:16:07 PST 2011


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

           Summary: __traits(compiles, ...) fails when given a template
                    property function without parens
           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 21:13:49 PST ---
This fails to compile:

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

void main()
{
    S s;
    s.func!int;
    static assert(__traits(compiles, s.func!int));
}

and gives this error:

test.d(13): Error: static assert  (__traits(compiles,s.func!(int))) is false


If you change s.func!int to s.func!int() in the __traits statement, then it
compiles. But while the program itself can handle s.func!int, __traits can't.
It needs the parens. And as soon as properties are fixed so that they _can't_
be called with parens, then this will be that much more of a problem.

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