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
https://github.com/D-Programming-Language/dmd/pull/5432
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/4a38b1d326ef8e48289309863f35d36c6d9c4e20 Fix issue #15665: Templated scope class with constructor doesn't compile While instantiating a template, FuncDeclaration::semantic3 will call into TypeFunction::semantic, but the flags SCOPEctor is only set during CtorDeclaration::semantic. https://github.com/D-Programming-Language/dmd/commit/c32ccb7c12c53d230d722d4e9b2414b38c3097bf Merge pull request #5432 from mathias-lang-sociomantic/fix-15665 Fix issue #15665: Templated scope class with constructor doesn't compile
Commits pushed to stable at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/e8c4f5ed9124a3e18081699789ad5cd6efc7aa94 Fix issue #15665: Templated scope class with constructor doesn't compile While instantiating a template, FuncDeclaration::semantic3 will call into TypeFunction::semantic, but the flags SCOPEctor is only set during CtorDeclaration::semantic. https://github.com/D-Programming-Language/dmd/commit/83be084357b5529d3d9fa2338c8bffb6fa3862c8 Merge pull request #5493 from Dicebot/pick-15665 Cherry-pick fix for issue 15665 into stable
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/e8c4f5ed9124a3e18081699789ad5cd6efc7aa94 Fix issue #15665: Templated scope class with constructor doesn't compile https://github.com/D-Programming-Language/dmd/commit/83be084357b5529d3d9fa2338c8bffb6fa3862c8 Merge pull request #5493 from Dicebot/pick-15665