www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21803] New: " nogc:" incorrectly propagates into function

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

          Issue ID: 21803
           Summary: " nogc:" incorrectly propagates into function blocks
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: eyal weka.io

This compiles successfully:

  struct S {
       nogc
      void f() {
          scope dlg = { new int; };
      }
  }

Whereas this doesn't, because it complains the "new" violates  nogc.

  struct T {
       nogc:
      void f() {
          scope dlg = { new int; };
      }
  }

--
Apr 05 2021