mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Enable conversions to value-or-ref to use value_of_initializer (#6309)
As a byproduct, the only test that exercised the "address of a temporary object" diagnostic now trigers the "address of a non-reference expression" diagnostic. We could restore it by using a type that doesn't support `value_of_initializer`, but it seems better to remove the diagnostic altogether: not only does it simplify the code, I'd also argue "non-reference expression" is more accurate as a user-facing description of the operand.
This commit is contained in:
@@ -53,7 +53,7 @@ fn AddressOfOperator() {
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
&(true and false);
|
||||
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of a temporary object [AddrOfEphemeralRef]
|
||||
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef]
|
||||
// CHECK:STDERR: &H().a;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
|
||||
Reference in New Issue
Block a user