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.