[Issue 14450] New: Incorrect overloading of immutable constructor for template struct
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Apr 15 10:03:19 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14450
Issue ID: 14450
Summary: Incorrect overloading of immutable constructor for
template struct
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: maximzms at gmail.com
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)
--
More information about the Digitalmars-d-bugs
mailing list