https://issues.dlang.org/show_bug.cgi?id=12931
--- Comment #6 from Jonathan M Davis <[email protected]> --- > You mean "illegal on the *right*" Yeah, sorry. > these are currently also legal and equivalent to your example: > const: Bar foo() {...} > const{ Bar foo() {...} } > Those OK or not? I'd say yes. What needs to be illegal are ambiguous cases. There's no way that const: or const{} could refer to the return type. > Come to think of it, this is also not ambiguous: > const void foo() {...} > But I think this should also be disallowed for consistency Agreed. Even if it's clear to the compiler, it's just bizarre to the programmer. Also, if we can ever get to the point that const without parens on left applies to the return type rather than the function, then allowing const void would definitely be bad. > Also, shared is in this category, as it is a type constructor. Yeah. Any attribute which could affect the return type should be illegal no the left. > Hah, I didn't realize we can now vote more than once for an issue. Really > Jonathan, 9 votes? LOL. Well, that's how many votes I had, and I was really ticked about this when I created it, so when I figured out that it would let me put multiple votes on it, I did. The fact that public, private, static, etc. can't go on the right completely goes against the entire argument for why const is allowed on the left, and as soon as I figured that I out, I was pretty mad that we'd ever agreed to let const be on the left. The whole consistency argument is bogus with regards to the current implementation, and I've never thought that the consistency was worth it here anyway. We either need to actually make them all consistent and let them all go on the right or disallow the ones on the left that are ambiguous. I vote strongly for the latter, as it's less bug-prone. --
