Bug 12793 – inout template member function with templated 'this' doesn't properly apply inout

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-05-23T22:45:40Z
Last change time
2024-12-13T18:20:54Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
Steven Schveighoffer
Moved to GitHub: dmd#18831 →

Comments

Comment #0 by schveiguy — 2014-05-23T22:45:40Z
Sample: struct X(Data) { Data d; inout(Data)* foo(this This)() inout // line 4 { return &d; } } void main() { immutable x = X!double(5.9); auto r = x.foo(); } Result: inouttest.d(4): Error: inout on return means inout must be on a parameter as well for immutable inout(double)*() Clearly, inout is not applying to the function when it should. Removing "(this This)" fixes the problem
Comment #1 by robert.schadek — 2024-12-13T18:20:54Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18831 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB