www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19182] New: missing semicolon crashes compiler

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

          Issue ID: 19182
           Summary: missing semicolon crashes compiler
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Keywords: ice
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: simen.kjaras gmail.com

void foo() {
    pragma(msg, "") // Here
    static foreach (e; [1]) {
        pragma(msg, "");
    }
}

Removing the surrounding function scope causes an error message:
foo.d(1): Error: pragma `msg` is missing a terminating ;

If the array is empty, it compiles without error (accepts-invalid).
If there's no pragma(msg) inside the static foreach, it compiles without error.
If I use (non-static) tuple foreach, it compiles without error.

--
Aug 20 2018