www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15665] New: Templated scope class with constructor don't

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

          Issue ID: 15665
           Summary: Templated scope class with constructor don't compile
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: mathias.lang sociomantic.com
                CC: public dicebot.lv

The following code:

```
scope class Foo (V)
{
    this () {}
}

void main ()
{
    scope f = new Foo!(Object);
}
```

Results in:
```
scope_class.d(3): Error: functions cannot return scope scope_class.Foo!(Object)
scope_class.d(8): Error: template instance scope_class.Foo!(Object) error
instantiating
```

Which is obviously wrong. Not providing a constructor, or making the class a
non-template works as expected. That's a D1 regression.

Tested with 2.066, 2.069, 2.070

--
Feb 09 2016