Bug 14450 – Incorrect overloading of immutable constructor for template struct

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-04-15T17:03:00Z
Last change time
2016-10-01T11:45:39Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
maximzms

Comments

Comment #0 by maximzms — 2015-04-15T17:03:19Z
test.d: -------------------- struct Foo // No templates - OK { this(int) {} this(int) immutable {} } struct Boo() // Template structure and ctors - OK { this()(int) {} this()(int) immutable {} } struct Bar() // Template structure - Error { this(int) {} this(int) immutable {} } void main() { Foo(1); Boo!()(1); Bar!()(1); // Error } -------------------- DMD output: -------------------- test.d(24): Error: test.Bar!().Bar.__ctor called with argument types (int) matches both: test.d(15): test.Bar!().Bar.this(int _param_0) and: test.d(16): test.Bar!().Bar.this(int _param_0) -------------------- The overload works correctly for both regular struct and template with template constructors, but fails for template struct with regular constructors. May be related to [issue 13475](https://issues.dlang.org/show_bug.cgi?id=13475)
Comment #1 by k.hara.pg — 2015-06-02T12:55:12Z
Comment #2 by github-bugzilla — 2016-07-12T00:23:31Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/9da3b92799d25c5459c4e35b47114596d9ec5720 fix Issue 14450 - Incorrect overloading of immutable constructor for template struct https://github.com/dlang/dmd/commit/1e34dcc043ecd5265c6ba6720cfa5564944c1b3f Merge pull request #4712 from 9rnsr/fix14450 Issue 14450 - Incorrect overloading of immutable constructor for template struct
Comment #3 by github-bugzilla — 2016-10-01T11:45:39Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/9da3b92799d25c5459c4e35b47114596d9ec5720 fix Issue 14450 - Incorrect overloading of immutable constructor for template struct https://github.com/dlang/dmd/commit/1e34dcc043ecd5265c6ba6720cfa5564944c1b3f Merge pull request #4712 from 9rnsr/fix14450