[Issue 7538] New: All kinds of property functions should be called before getting their types inside typeof

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 18 07:48:15 PST 2012


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

           Summary: All kinds of property functions should be called
                    before getting their types inside typeof
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: k.hara.pg at gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2012-02-18 07:48:12 PST ---
Test case;
----
@property int foo(){ return 1; }
@property int bar()(){ return 2; }
@property int baz(T)(){ return 2; }

struct S
{
    @property int foo(){ return 1; }
    @property int bar()(){ return 2; }
    @property int baz(T)(){ return 2; }
}

void main()
{
    static assert(is(typeof(foo) == int));          // OK
    static assert(is(typeof(bar) == int));          // failed
    static assert(is(typeof(baz!int) == int));      // OK

    S s;
    static assert(is(typeof(s.foo) == int));        // OK
    static assert(is(typeof(s.bar) == int));        // failed
    static assert(is(typeof(s.baz!int) == int));    // OK
}

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