http://d.puremagic.com/issues/show_bug.cgi?id=9498
--- Comment #4 from yebblies <[email protected]> 2013-06-30 15:15:17 EST --- (In reply to comment #3) > (In reply to comment #2) > > Note the ref return from getValue, which makes 'myValues[v]' an lvalue. It > > could still be invalid, but not for the reasons stated. > > This is irrelevant. The fact that function returns by ref indicates that value > should not be copied but returned by ref. If "myValue" was present that would > mean that pointer to the string is returned. Irrespective of how value is > returned, myValues[v] is invalid value here. This code works because indexing an AA with a key that does not exist is valid in an lvalue context: int[string] aa; aa["asd"] += 2; The following code also indexes an AA with a missing key in an lvalue context: int[string] aa; ref int get() { return aa["asd"]; } get() += 2; The assumption here is that indexing an AA with a non-existing key in a context where an lvalue is expected does not result in a range violation. Do you know of any reason why this is an incorrect assumption? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
