[Issue 9822] Using module variable of templated type parametrized by lambda

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon May 27 22:03:04 PDT 2013


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


Maxim Fomin <maxim at maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxim at maxim-fomin.ru
          Component|Phobos                      |DMD
            Summary|Segfault when referencing   |Using  module variable of
                   |module-global auto variable |templated type parametrized
                   |containing range that       |by lambda
                   |updates array literal       |
           Severity|normal                      |critical


--- Comment #5 from Maxim Fomin <maxim at maxim-fomin.ru> 2013-05-27 22:03:00 PDT ---
Simplified: 

struct MapResult(alias fun) {
    @property auto ref front() {
        return fun(1);
    }
}

auto map(alias fun)() {
    return MapResult!(fun)();
}

auto foo(int[] r) {
    return map!((int x) => r)();
}

auto result = foo([1]);

void main() {
    result.front();
}

There is wrong-code on accessing or passing module object. It has nothing to do
with auto or ranges.

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