Bug 11966 – Regression 2.065.b1: inout(const(char))[] doesn't convert to inout(char)[]
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-01-22T03:55:00Z
Last change time
2014-01-23T04:15:47Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
doob
Comments
Comment #0 by doob — 2014-01-22T03:55:12Z
The following code used to work with 2.064.2:
inout(char)[] stripped (inout(char)[] path)
{
return path;
}
struct PathParser
{
inout(const(char))[] pop () inout
{
return stripped (path);
}
inout(const(char))[] path () inout
{
return null;
}
}
void main ()
{
auto a = PathParser().pop;
}
With 2.065.b1 it results in this error:
Error: function main.stripped (inout(char)[] path) is not callable using argument types (inout(const(char))[])
(In reply to comment #1)
> https://github.com/D-Programming-Language/dmd/pull/3138
>
> 'inout const' type qualifier is introduced by fixing issue 6930, but its first
> implementation had not been perfect.
what does 'inout const' mean?
Comment #3 by k.hara.pg — 2014-01-23T02:09:13Z
(In reply to comment #2)
> (In reply to comment #1)
> > https://github.com/D-Programming-Language/dmd/pull/3138
> >
> > 'inout const' type qualifier is introduced by fixing issue 6930, but its first
> > implementation had not been perfect.
>
> what does 'inout const' mean?
- A common type qualifier between immutable and inout
- If inout function returns inout(const(T)), it will be deduced to const(T), immutable(T), or inout(const(T)). Different from inout(T), it won't be deduced to T because 'const' sticks.
Comment #4 by github-bugzilla — 2014-01-23T03:37:27Z