September 14, 2014 [Issue 13475] New: Incorrect overloading of immutable constructor for nested struct | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13475 Issue ID: 13475 Summary: Incorrect overloading of immutable constructor for nested struct Product: D Version: D2 Hardware: x86 OS: Mac OS X Status: NEW Severity: normal Priority: P1 Component: DMD Assignee: nobody@puremagic.com Reporter: andrei@erdani.com Smoking gun: struct A(T) { struct B { this(size_t); this(size_t) immutable { } this(string s) { this(s.length); } } } void main() { A!int s1; } This fails with: test.d(15): Error: test.A!int.A.B.__ctor called with argument types (ulong) matches both: test.d(7): test.A!int.A.B.this(ulong) and: test.d(9): test.A!int.A.B.this(ulong _param_0) test.d(22): Error: template instance test.A!int error instantiating Deleting the body of the immutable constructor oddly makes the error go away (becomes a link-time error; adding a body for the first constructor makes the program compile and link). -- |
Copyright © 1999-2021 by the D Language Foundation