(Note that I don't have access to 4.7.x or 4.8.x on Ubuntu, this might not apply anymore ! sorry if it is the case) gdc (Ubuntu/Linaro 4.6.3-1ubuntu1) 4.6.3 DMD32 D Compiler v2.059 GDC allows this: (it will crash on execution) void main() { string str = "allo"; str.reverse; str.sort; } But dmd will catch the error at compile time: dmd testStringReverse.d testStringReverse.d(4): Error: can only reverse a mutable array testStringReverse.d(5): Error: can only sort a mutable array
This correctly prints the error at compile time with gdc commit 9bcc0b7159 (4.7 branch) gcc 4.7.1 (on ARM / raspberry pi, shouldn't matter) dmd frontend 2.059 Please reopen this bug if it still occurs for you with the latest version of gdc. gdc hello.d -o hello hello.d:5: Error: can only reverse a mutable array hello.d:6: Error: can only sort a mutable array
ok, good. I'll try it out to be sure when I can get my hands on the newest version thx