Bug 1677 – Segfault on specialization on template with one non-tuple and one tuple parameter

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2007-11-17T10:34:00Z
Last change time
2014-02-24T15:32:31Z
Keywords
ice-on-invalid-code
Assigned to
bugzilla
Creator
jarrett.billingsley

Comments

Comment #0 by jarrett.billingsley — 2007-11-17T10:34:12Z
struct Temp(T, U...) { } void foo(T : Temp!(U, V), U, V)(T t) { } void main() { Temp!(float, float, char) y; foo!(typeof(y))(y); } Interesting things: - Using "Temp!(float, float) y" instead works. - Using a specialization with three inferred parameters instead of two ("T : Temp!(U, V, W), U, V, W") works. - Using a specialization with one inferred parameter causes a compilation error. - Changing the template Temp to take only a tuple parameter (remove T) causes compilation errors. I don't know whether to flag this as 'ice-on-invalid-code' or 'ice-on-valid-code' because I don't even know if this code is valid.
Comment #1 by smjg — 2008-09-09T15:30:34Z
Of course it's invalid. Temp!(float, float, char) (three arguments) doesn't match Temp!(U, V) (two arguments). But under DMD 1.033 and 1.035, it reports an error as expected. bz1677.d(14): template instance foo!(Temp!(float,float,char)) does not match any template declaration bz1677.d(14): Error: template instance 'foo!(Temp!(float,float,char))' is not a variable bz1677.d(14): Error: function expected before (), not foo!(Temp!(float,float,char)) of type int