Bug 2128 – Template function argument binding is too restrictive wrt qualifiers

Status
RESOLVED
Resolution
WORKSFORME
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2008-05-24T12:10:39Z
Last change time
2018-05-15T14:00:58Z
Assigned to
Walter Bright
Creator
Andrei Alexandrescu

Comments

Comment #0 by andrei — 2008-05-24T12:10:39Z
This code won't compile: void foo(Idx)(Idx a, Idx b) {} void main(string[] args) { uint x; invariant uint y; foo(x, y); } I think it should.
Comment #1 by bruno.do.medeiros+deebugz — 2008-05-28T16:18:52Z
What would typeof(Idx) be in that instantiation? const(uint)?
Comment #2 by bugzilla — 2008-06-15T20:43:04Z
I agree with Bruno, I don't know what rule to use to accept this.
Comment #3 by simen.kjaras — 2011-03-15T10:21:31Z
*** Issue 2594 has been marked as a duplicate of this issue. ***
Comment #4 by clugdbug — 2012-11-12T07:35:28Z
Changing to enhancement.
Comment #5 by dmitry.olsh — 2018-05-15T14:00:58Z
Works with s/invariant/immutable/: void foo(Idx)(Idx a, Idx b) {} void main(string[] args) { uint x; immutable uint y; foo(x, y); } Compiles just fine.