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
Comment #1 by bugzilla — 2016-02-10T01:58:25Z
Comment #2 by github-bugzilla — 2016-02-10T03:48:17Z
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
Comment #3 by github-bugzilla — 2016-03-02T09:36:17Z
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
Comment #4 by github-bugzilla — 2016-03-14T14:43:23Z