[Issue 17444] New: std.traits.isCallable doesn't recognize struct member function if return type is 'auto'.
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat May 27 04:01:55 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=17444
Issue ID: 17444
Summary: std.traits.isCallable doesn't recognize struct member
function if return type is 'auto'.
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: dario.schiavon at gmail.com
import std.traits : isCallable;
struct MyStruct
{
auto foo() { return MyStruct(); }
static if (isCallable!foo)
pragma(msg, "GOOD");
else
pragma(msg, "BAD");
}
Prints "GOOD" if foo returns 'MyStruct' instead of 'auto'.
Member function foo is actually usable in both cases.
I'm unsure whether this is a Phobos problem or a compiler problem.
Using DMD32 v2.074.0 or LDC2 v1.1.1 (which is based on DMD v2.071.2).
--
More information about the Digitalmars-d-bugs
mailing list