[Issue 17836] New: ICE with custom 'map' template

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Sep 17 22:04:00 UTC 2017


https://issues.dlang.org/show_bug.cgi?id=17836

          Issue ID: 17836
           Summary: ICE with custom 'map' template
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: elronnd at protonmail.ch

This code causes an ICE in dmd and gdc.  Under LDC it compiles without errors
and when run it does exactly as expected:

void main() {
        import std.stdio;

        template mmap(alias fun) {
                void mmap(T...)(T list) {
                        foreach (item; list) {                                  
                                fun(item);
                        }
                }                                                               
        }


        void printstuffs(T...)(T args) {
                void printer(G)(G arg) {
                        writeln(arg);
                }

                mmap!printer(args);
        }


        printstuffs("bla", 7, 9.0);
}

--


More information about the Digitalmars-d-bugs mailing list