www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23127] New: safe inference seems to depend on semantic


          Issue ID: 23127
           Summary:  safe inference seems to depend on semantic analysis
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: kinke gmx.net

Created attachment 1853
  --> https://issues.dlang.org/attachment.cgi?id=1853&action=edit
4 source modules

The attached archive contains 4 dustmited modules. With DMD v2.100.0, all 4
modules can be individually compiled just fine.

With `-allinst` however, compiling `variant.d` (alone) fails with:
rbtree.d(36): Error: ` safe` function `rbtree.RedBlackTree!(Pair,
lessPairKeys).RedBlackTree.toHash` cannot call ` system` function
rbtree.d(22):        `rbtree.RBRange!(RBNode!(Pair)*).RBRange.popFront` is
declared here
statictypes.d(12): Error: template instance `rbtree.RedBlackTree!(Pair,
lessPairKeys)` error instantiating
statictypes.d(15):        instantiated from here: `Map!(string, SType)`

The 3 other modules compile fine with `-allinst` too.

Prepending another root module works: `dmd -o- -allinst statictypes.d
variant.d`. Swapping the root modules order makes it fail again: `dmd -o-
-allinst variant.d statictypes.d`

May 19 2022