www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4724] New: Template literal escaping: Inconsistent behavior when -inline is on

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

           Summary: Template literal escaping:  Inconsistent behavior when
                    -inline is on
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: dsimcha yahoo.com


--- Comment #0 from David Simcha <dsimcha yahoo.com> 2010-08-25 08:31:42 PDT ---
Not sure if this is a rejects-valid or an accepts-invalid, since the spec isn't
clear on how passing template alias parameters that refer to a function scope
is supposed to work.  The inconsistency, though, means at least one of these is
wrong.

import std.algorithm, std.array;

void main() {
    uint[] arr = [1, 2, 3];

    // Doesn't work with -inline
    auto res1 = array(
        map!((a) { return a == arr[0]; })(arr)
    );

    // Works if the previous statement is commented out or -inline
    // is disabled.
    auto res2 = array(
        map!((uint a) { return a == arr[0]; })(arr)
    );
}

Error message (version 2.048, only when -inline is enabled):

test.d(8): Error: function D main is a nested function and cannot be accessed
from array

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 25 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4724


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc


--- Comment #1 from bearophile_hugs eml.cc 2011-09-22 14:19:41 PDT ---
This is an important issue, I hit it often.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 22 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4724


David Simcha <dsimcha yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


--- Comment #2 from David Simcha <dsimcha yahoo.com> 2012-01-24 13:41:42 PST ---
*** This issue has been marked as a duplicate of issue 4841 ***

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