www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Why can't 'scope' be inferred here?

The following code fails to compile with -dip1000:

struct Inner(T) {
     T value;
     this(ref T value) { this.value = value; }

struct Outer(T) {
     Inner!T inner;
     void opAssign(ref T rhs) { inner = Inner!T(rhs); }

 safe void main() {
     int x;
     int* p = &x;
     Outer!(int*) o;
     o = p;

(Interactive: https://run.dlang.io/is/yYTReh)

Changing Inner's constructor to take a `scope ref T value` fixes 
the error. But since Inner is a template, and the body of the 
constructor is available to the compiler, shouldn't it be able to 
infer the `scope` attribute?
Jun 21 2019