www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13508] New: array vararg function safety not inferred


          Issue ID: 13508
           Summary: array vararg function safety not inferred
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: monarchdodra gmail.com

struct S
    this(T)(T[] t...)

template make(T)
    T make(Args...)(Args args) // safe
        return T(args);

void main()  safe
    S s = make!S(5);
Error: safe function 'D main' cannot call system function

If you mark "make" as explicitly safe, then it works.

Then again, I believe using "T[] t..." isn't safe to begin with...? (slice
contents are destroyed at end of scope). Either way, there's a bug in there.

Sep 20 2014