Bug 8961 – IFTI fails with templates in specialization

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-11-04T23:07:28Z
Last change time
2024-12-13T18:02:24Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
Denis Shelomovskii
Moved to GitHub: dmd#18486 →

Comments

Comment #0 by verylonglogin.reg — 2012-11-04T23:07:28Z
--- template Int(T) { alias int Int; } void f1(T)(T t, Int!T[] arr) { } void f2(T, U = Int!T)(T t, U[] arr) { } void f3(T, U : Int!T)(T t, U[] arr) { } void f4(T, U : V, V = Int!T)(T t, U[] arr) { } void f5(T, U = Int!T)(T t, U[] arr) if(is(U == Int!T)) { } void main() { int i; int[] arr; f1!int(i, arr); f1(i, arr); // error, line 15 f1(i, []); f1(i, null); f2!int(i, arr); f2(i, arr); f2(i, []); f2(i, null); f3!int(i, arr); // error, line 24 f3(i, arr); // error, line 25 f3(i, []); // error, line 26 f3(i, null); // error, line 27 f4!int(i, arr); f4(i, arr); f4(i, []); f4(i, null); // error, line 32 f5!int(i, arr); f5(i, arr); f5(i, []); // error, line 36 f5(i, null); } --- Output: --- main.d(15): Error: template main.f1 does not match any function template declaration main.d(15): Error: template main.f1(T) cannot deduce template function from argument types !()(int,int[]) main.d(24): Error: template main.f3 does not match any function template declaration main.d(24): Error: template main.f3(T,U : Int!(T)) cannot deduce template function from argument types !(int)(int,int[]) main.d(24): Error: template instance f3!(int) errors instantiating template main.d(25): Error: template main.f3 does not match any function template declaration main.d(25): Error: template main.f3(T,U : Int!(T)) cannot deduce template function from argument types !()(int,int[]) main.d(26): Error: template main.f3 does not match any function template declaration main.d(26): Error: template main.f3(T,U : Int!(T)) cannot deduce template function from argument types !()(int,void[]) main.d(27): Error: template main.f3 does not match any function template declaration main.d(27): Error: template main.f3(T,U : Int!(T)) cannot deduce template function from argument types !()(int,typeof(null)) main.d(32): Error: template main.f4 does not match any function template declaration main.d(32): Error: template main.f4(T,U : V,V = Int!(T)) cannot deduce template function from argument types !()(int,typeof(null)) main.d(36): Error: template main.f5 does not match any function template declaration main.d(36): Error: template main.f5(T,U = Int!(T)) if (is(U == Int!(T))) cannot deduce template function from argument types !()(int,void[]) ---
Comment #1 by nick — 2023-02-28T18:36:28Z
Lines 16 and 17 are now compile errors also. Lines 32 and 36 now compile without error.
Comment #2 by robert.schadek — 2024-12-13T18:02:24Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18486 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB