http://d.puremagic.com/issues/show_bug.cgi?id=6930
--- Comment #15 from Kenji Hara <[email protected]> 2011-12-04 21:37:31 PST --- While implementing this enhancement, I've found an issue. Following code now can compile, but introducing inout(const(T)) breaks it. bool hasDrive(C)(in C[] path) { return true; } inout(C)[] stripDrive(C)(inout(C)[] path) { if (hasDrive(path)) // Line 7 return path[2 .. $]; return path; } void main() { assert(stripDrive(`c:\`) == `\`); } -- error with my local patched dmd test.d(1): Error: inout on parameter means inout must be on return type as well (if from D1 code, replace with 'ref') test.d(1): Error: variable test.hasDrive!(inout(char)).hasDrive.path inout variables can only be declared inside inout functions test.d(7): Error: template instance test.hasDrive!(inout(char)) error instantiating test.d(13): instantiated from here: stripDrive!(char) test.d(13): Error: template instance test.stripDrive!(char) error instantiating In IFTI with hasDrive(path), C is deduced as inout(char), then a parameter 'path' is typed as 'in inout(char)', it is translated as inout(const(char)). Give me opinions, please. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
