Bug 19606 – Bad error message when two identical overloads exist as `@disable` and not
Status
RESOLVED
Resolution
INVALID
Severity
minor
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-01-23T10:03:00Z
Last change time
2022-02-07T19:19:40Z
Keywords
diagnostic, rejects-valid
Assigned to
No Owner
Creator
Basile-z
Comments
Comment #0 by b2.temp — 2019-01-23T10:03:00Z
code:
class Foo
{
@disable this();
this(){}
}
void main()
{
Foo foo = new Foo;
}
> Error: `runnable.Foo.__ctor` called with argument types `()` matches both:
I think that the compiler should detect an error before this one and rather complain that the same function exists as `@disable` and not.
Comment #1 by b2.temp — 2019-01-23T13:06:25Z
I was trying to fix that and realized that another point of view is possible: the `@disable` overload is not designed to be used. The other yes. Consequently the code has to compile...
A kind of decision / clarification about the semantic is required here.
Comment #2 by tiberiulepadatu14 — 2019-03-07T21:35:33Z
(In reply to Basile-z from comment #0)
> code:
>
> class Foo
> {
> @disable this();
> this(){}
> }
>
> void main()
> {
> Foo foo = new Foo;
> }
>
> > Error: `runnable.Foo.__ctor` called with argument types `()` matches both:
>
> I think that the compiler should detect an error before this one and rather
> complain that the same function exists as `@disable` and not.
But why are you creating tow functions with the same name? What is the error that you think that should be thrown?