This seems to be a regression due to the following change:
https://github.com/D-Programming-Language/dmd/commit/79ae211e71cf0937523010e39f7f0981e9550904
struct S
{
@disable this();
static void opCall()
{}
}
void main()
{}
Error: struct deneme.S static opCall is hidden by constructors and can never be called
It doesn't seem right to me that a disabled constructor hides opCall.
Ali
Comment #1 by issues.dlang — 2015-01-31T06:05:20Z
Yeah. That sounds like a bug. static opCall isn't a constructor. At most, it's a factory function, and it doesn't even have to be that (e.g. LocalTime and UTC in std.datetime use it as the function to get at their singeltons - they're classes though, not structs, and don't @disable this).
Comment #2 by k.hara.pg — 2015-02-03T13:32:34Z
(In reply to Ali Cehreli from comment #0)
> This seems to be a regression due to the following change:
>
> https://github.com/D-Programming-Language/dmd/commit/
> 79ae211e71cf0937523010e39f7f0981e9550904
>
> struct S
> {
> @disable this();
>
> static void opCall()
> {}
> }
>
> void main()
> {}
>
> Error: struct deneme.S static opCall is hidden by constructors and can never
> be called
>
> It doesn't seem right to me that a disabled constructor hides opCall.
It's intended behavior.
With the expression S(), is it a default construction (but it's @disable-d), or a call of static opCall()? They conflicts each other.
Therefore compiler raises an error for the struct declaration.
Comment #3 by bugzilla — 2015-02-06T04:48:09Z
(In reply to Kenji Hara from comment #2)
> Therefore compiler raises an error for the struct declaration.
I agree. Such code looks pretty dubious anyway, I'm good with it being an error.