[Issue 20246] isCallable fails for template opCall overload

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Sep 27 06:34:43 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=20246

Simen Kjaeraas <simen.kjaras at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simen.kjaras at gmail.com

--- Comment #1 from Simen Kjaeraas <simen.kjaras at gmail.com> ---
It's impossible to distinguish between the above case and this:

struct S { enum opCall(T) = true; }

Clearly, the latter is *not* callable.

To illustrate the situation perhaps more clearly:

struct S {
    template opCall(T) {
        static if (is(T == int)) {
            void opCall(T t) {}
        } else {
            enum opCall = 14;
        }
    }
}

The above is perfectly valid code, but should isCallable!S return true?

--


More information about the Digitalmars-d-bugs mailing list