Thread overview | |||||
---|---|---|---|---|---|
|
October 12, 2011 [Issue 6809] New: IFTI should imply const where inout is present on args, but not on return type | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=6809 Summary: IFTI should imply const where inout is present on args, but not on return type Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: schveiguy@yahoo.com --- Comment #0 from Steven Schveighoffer <schveiguy@yahoo.com> 2011-10-12 16:32:01 PDT --- example: void foo(T)(T v) { } inout(int)* bar(inout(int)* x) { foo(x); return x; } bug.d(1): Error: inout on parameter means inout must be on return type as well (if from D1 code, replace with 'ref') bug.d(1): Error: variable bug.foo!(inout(int)*).foo.v inout variables can only be declared inside inout functions bug.d(7): Error: template instance bug.foo!(inout(int)*) error instantiating It is safe for IFTI to assume all inout parameters are const instead of inout, since inout implicitly casts to const. However, inout should still be used where it participates in the return type. For example, this currently-valid code should continue to compile: T foo(T)(T v) { return v; } inout(int)* bar(inout(int)* x) { return foo(x); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 28, 2012 [Issue 6809] IFTI should imply const where inout is present on args, but not on return type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | http://d.puremagic.com/issues/show_bug.cgi?id=6809 SomeDude <lovelydear@mailmetrash.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lovelydear@mailmetrash.com --- Comment #1 from SomeDude <lovelydear@mailmetrash.com> 2012-04-28 02:21:59 PDT --- Compiles with dmd 2.059 Win32 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 09, 2013 [Issue 6809] IFTI should imply const where inout is present on args, but not on return type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | http://d.puremagic.com/issues/show_bug.cgi?id=6809 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2013-04-08 21:17:17 PDT --- By fixing 7105, it has been changed to valid code. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation