Thread overview
[Issue 14087] @disable this hides static opCall
Jan 31, 2015
Jonathan M Davis
Feb 03, 2015
Kenji Hara
Feb 06, 2015
Walter Bright
January 31, 2015
https://issues.dlang.org/show_bug.cgi?id=14087

Jonathan M Davis <issues.dlang@jmdavisProg.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |issues.dlang@jmdavisProg.co
                   |                            |m

--- Comment #1 from Jonathan M Davis <issues.dlang@jmdavisProg.com> ---
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).

--
February 03, 2015
https://issues.dlang.org/show_bug.cgi?id=14087

--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> ---
(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.

--
February 06, 2015
https://issues.dlang.org/show_bug.cgi?id=14087

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|---                         |INVALID

--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> ---
(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.

--
June 09, 2015
https://issues.dlang.org/show_bug.cgi?id=14087

Andrei Alexandrescu <andrei@erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|future                      |D2

--