www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12237] New: Inconsistent behavior of the instantiating enclosing template function

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

           Summary: Inconsistent behavior of the instantiating enclosing
                    template function
           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> 2014-02-23 23:42:30 PST ---
In the case, func is a template function, and (a) { ... } is a template lambda
(== template function). So the both should work as same.

auto func(T)(T)
{
    static if (is(T == int))
        return func("");
    else
        return 10;
}

void main()
{
    assert(func(1) == 10);

    assert((a) {
        static if (is(typeof(a) == int))
        {
            int x;
            return __traits(parent, x)("");  // line 17
        }
        else
            return 10;
    } (1) == 10);
}

---
test.d(17)Error: function literal __lambda1 (int a) is not callable using
argument types (string)

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 23 2014
parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12237


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2014-03-09 21:22:08 PDT ---
https://github.com/D-Programming-Language/dmd/pull/3370

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