Bug 7873 – [2.059 beta] IFTI with inout does not properly match template parameter if called from inout function for pointers

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-04-09T08:58:00Z
Last change time
2012-04-09T22:02:27Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
schveiguy

Comments

Comment #0 by schveiguy — 2012-04-09T08:58:18Z
This worked in 2.058: inout(T) * foo(T)(inout(T)* t) { static assert(is(T == int *)); return t; } inout(T)* bar(T)(inout(T)* t) { return foo(t); } void main() { int *i; bar(&i); } It fails the assert in the 2.059 beta. It seems to only happen if 'i' is a pointer, and only if foo is called with an inout variable from an inout function. Note that the function still compiles ( with typeof(t) == inout(int *)* ), it's just that the T is not properly extracted using IFTI. This has consequences if you use T to create another template.
Comment #1 by k.hara.pg — 2012-04-09T19:40:02Z
This issue was introduced by merging dmd/pull#800. https://github.com/D-Programming-Language/dmd/pull/800 A pull to fix this issue. https://github.com/D-Programming-Language/dmd/pull/872
Comment #2 by github-bugzilla — 2012-04-09T21:01:05Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/7c22b8af8041a97c74e87a6e941ef14bb49905b6 Merge pull request #872 from 9rnsr/fix7873 Issue 7873 - IFTI with inout does not properly match template parameter if called from inout function for pointers