Thread overview
[Issue 6994] New: Using explicit 'this' in template constraint causes an error
Nov 23, 2011
Kenji Hara
Nov 23, 2011
Kenji Hara
Nov 24, 2011
Walter Bright
November 23, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6994

           Summary: Using explicit 'this' in template constraint causes an
                    error
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: k.hara.pg@gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg@gmail.com> 2011-11-23 00:29:54 PST ---
struct Foo {

    T get(T)(){ return T.init; }

    T func1(T)()
    if (__traits(compiles, get!T()))
    { return get!T; }

    T func2(T)()
    if (__traits(compiles, this.get!T()))   // add explicit 'this'
    { return get!T; }
}
void main()
{
    Foo foo;
    foo.get!int();      // OK
    foo.func1!int();    // OK
    foo.func2!int();    // NG
}

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2011-11-23 05:31:52 PST ---
D2 patch: https://github.com/D-Programming-Language/dmd/pull/524

Maybe D1 has same issue.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 24, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6994


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2011-11-24 00:01:28 PST ---
https://github.com/D-Programming-Language/dmd/commit/1f2c811c7d7c3dd93d74665dec230bc7c9b4ee9c

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