[Issue 20389] New: __traits(isDisabled) with invalid template function
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Nov 13 17:24:41 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=20389
Issue ID: 20389
Summary: __traits(isDisabled) with invalid template function
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: john.michael.hall at gmail.com
If you @disable a templated function that is not valid and then try to call
__traits(isDisabled) on it with the template instantiated with something other
than a type, then you will get a message that the template instance does not
match the declaration. However, it does not tell you why. For instance, in the
code below, T should also be part of the template, but you can only find that
out if you actually call foo.
@disable T[] foo(U)(T[] x, T rhs)
{
return x ~ rhs;
}
unittest {
static assert(__traits(isDisabled, foo!"~"));
}
I would reiterate that this seems to be related to using something other than a
type in the instantiation. If I try the code below, then it tells me that T is
an undefined identifier.
unittest {
static assert(__traits(isDisabled, foo!(int)));
}
--
More information about the Digitalmars-d-bugs
mailing list