[Issue 14756] New: cannot deduce function with template constraint
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Jul 1 09:33:05 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14756
Issue ID: 14756
Summary: cannot deduce function with template constraint
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: regression
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: tim.dlang at t-online.de
The following code compiled with dmd v2.067, but results in an error for dmd
v2.068.0-b1:
// copied from std.traits
enum bool isInstanceOf(alias S, T) = is(T == S!Args, Args...);
struct Test(size_t id)
{
static void from(Other)(Other other) if(isInstanceOf!(Test, Other))
{
}
}
void main()
{
Test!(1) test;
Test!(2).from(test);
}
Here is the error message:
test.d(14): Error: template test.Test!2u.Test.from cannot deduce function from
argument types !()(Test!1u), candidates are:
test.d(6): test.Test!2u.Test.from(Other)(Other other) if
(isInstanceOf!(Test, Other))
If the template constraint uses the is-expression directly, the error goes
away.
--
More information about the Digitalmars-d-bugs
mailing list