[Issue 15665] New: Templated scope class with constructor don't compile

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Feb 9 12:18:00 PST 2016


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 at puremagic.com
          Reporter: mathias.lang at sociomantic.com
                CC: public at 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

--


More information about the Digitalmars-d-bugs mailing list