Bug 15665 – Templated scope class with constructor don't compile
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-02-09T20:18:00Z
Last change time
2016-03-14T14:43:23Z
Assigned to
nobody
Creator
mathias.lang
Comments
Comment #0 by mathias.lang — 2016-02-09T20:18:00Z
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