https://issues.dlang.org/show_bug.cgi?id=12821
--- Comment #2 from Kenji Hara <[email protected]> --- (In reply to Iain Buclaw from comment #0) > Penultimately, the following throw an error unless you specify void. All of > which seems redundant as there's no return type. > > immutable foo() { } // Without 'this' cannot be immutable > immutable void foo() { } // OK 'immutable' does not modify return type. But in module scope, 'this' qualifier for non-member function is meaningless and "Without 'this' cannot be immutable" error occurs in first case. But second case does not raise same error, and it's inconsistent behavior. > const foo() { } // Without 'this' cannot be const > const void foo() { } // OK > inout foo() { } // Without 'this' cannot be inout > inout void foo() { } // OK > shared foo() { } // Without 'this' cannot be shared > shared void foo() { } // OK As well, same "Without 'this' cannot be xxx" error should occur in all cases. To improve compiler behavior, I opened issue 12967. --
