www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11662] New: Template constraint evaluation should not look eponymous template function parameters if it's unnecessary

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11662

           Summary: Template constraint evaluation should not look
                    eponymous template function parameters if it's
                    unnecessary
           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> 2013-12-01 21:17:11 PST ---
Both template functions should work, but doesn't.

template gc_free1(T)
{
    alias Type = T*;
    void gc_free1(Type data) {}
}

template gc_free2(T) if (!is(T == class))
{
    alias Type = T*;
    void gc_free2(Type data) {}
}

void main()
{
    int* p;
    gc_free1!int(p);  // OK
    gc_free2!int(p);  // Error: undefined identifier Type
}

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 01 2013
parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11662


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice, pull
           Severity|normal                      |major


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-12-01 21:21:30 PST ---
With git head, the OP code causes compiler segfault.

https://github.com/D-Programming-Language/dmd/pull/2910

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