Bug 2410 – array's invariant storage class dropped by a template

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2008-10-09T10:36:00Z
Last change time
2015-06-09T01:21:35Z
Keywords
rejects-valid
Assigned to
nobody
Creator
qniol

Comments

Comment #0 by qniol — 2008-10-09T10:36:57Z
This snippet compiles correctly: class Class { void foo(int[2] arg) {} void foo(invariant(int[2]) arg) {} } int main() { (new Class).foo([1, 1]); return 0; } (foo call is linked to foo(int[2])) But this not: class Class(T, int n) { void foo(T[n] arg) {} void foo(invariant(T[n]) arg) {} } int main() { (new Class!(int, 2)).foo([1, 1]); return 0; } error: template.d(x): function template.Class!(int,2).Class.foo called with argument types: (int[2u]) matches both: template.Class!(int,2).Class.foo(int[2u]) and: template.Class!(int,2).Class.foo(int[2u])
Comment #1 by smjg — 2009-01-10T12:04:52Z
That the compiler prints "x" instead of a line number is a bug indeed. Are there others like this? At least this one's been fixed (trying on 2.023 Win), unless it's Linux-specific.
Comment #2 by yebblies — 2011-06-10T06:44:27Z
Works correctly in dmd 2.053