Bug 13475 – Incorrect overloading of immutable constructor for nested struct

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Mac OS X
Creation time
2014-09-14T18:46:26Z
Last change time
2024-12-13T18:26:41Z
Assigned to
No Owner
Creator
Andrei Alexandrescu
Moved to GitHub: dmd#18880 →

Comments

Comment #0 by andrei — 2014-09-14T18:46:26Z
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).
Comment #1 by robert.schadek — 2024-12-13T18:26:41Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18880 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB