Bug 12728 – [REG2.066a] IFTI should consider instantiated types that has template parameters with default args
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-05-10T08:53:00Z
Last change time
2014-05-10T21:04:55Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
temtaime
Comments
Comment #0 by temtaime — 2014-05-10T08:53:02Z
struct Matrix(T, uint M, uint N = M, ubyte _F = 0) {
pure opBinary(string op : `*`, uint R)(auto ref in Matrix!(T, N, R) b) const { return Matrix!(T, M, R)(); }
pure opUnary(string op: `-`)() const { return Matrix(); }
ref translate()(auto ref in Vector3 v) { return this; }
}
alias Vector(T, uint M) = Matrix!(T, 1, M);
alias Matrix4 = Matrix!(float, 4);
alias Vector3 = Vector!(float, 3);
void main() {
Matrix4 m;
m * m.translate(-Vector3());
}
This code should work and works on 065.
Comment #1 by temtaime — 2014-05-10T08:59:03Z
Sorry forgot error message
Error: 'm' is not of arithmetic type, it is a Matrix!(float, 4u, 4u, cast(ubyte)0u)
Error: 'm.translate(Matrix().opUnary())' is not of arithmetic type, it is a Matrix!(float, 4u, 4u, cast(ubyte)0u)
Comment #2 by k.hara.pg — 2014-05-10T13:23:17Z
Simplified test case:
struct Matrix(T, uint M, uint N = M, ubyte _F = 0)
{
void foo(uint R)(auto ref in Matrix!(T, N, R) b)
{
}
}
void main()
{
alias Matrix4 = Matrix!(float, 4);
Matrix4 m;
m.foo(m);
}
It has been introduced by the fix for issue 12725.
Fix: https://github.com/D-Programming-Language/dmd/pull/3539
Comment #3 by github-bugzilla — 2014-05-10T21:04:54Z