You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When looking up C++ operators, make sure all operands are complete (#6132)
This diagnoses instead of crashing in some cases:
* When one of the operands is an incomplete Carbon type.
* When one of the operands is a C++ class that can't be completed due to
lack of Carbon supported.
The new tests cover these cases.
Part of #5995.
var complete: Cpp.Complete= Cpp.Complete.Complete();
806
+
// CHECK:STDERR: fail_incomplete_operand_carbon_type.carbon:[[@LINE+10]]:21: error: looking up a C++ operator with incomplete operand type `Incomplete` [IncompleteOperandTypeInCppOperatorLookup]
807
+
// CHECK:STDERR: let result: i32 = *CreateIncomplete() + complete;
808
+
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
809
+
// CHECK:STDERR: fail_incomplete_operand_carbon_type.carbon:[[@LINE-8]]:1: note: class was forward declared here [ClassForwardDeclaredHere]
810
+
// CHECK:STDERR: class Incomplete;
811
+
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
812
+
// CHECK:STDERR: fail_incomplete_operand_carbon_type.carbon:[[@LINE+4]]:21: note: in `Cpp` operator `AddWith` lookup [InCppOperatorLookup]
813
+
// CHECK:STDERR: let result: i32 = *CreateIncomplete() + complete;
// CHECK:STDERR: let result: i32 = supported + Cpp.unsupported;
842
+
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
843
+
// CHECK:STDERR: fail_import_unsupported_in_instantiation.carbon:[[@LINE+7]]:21: note: while completing C++ type `Cpp.Unsupported` [InCppTypeCompletion]
844
+
// CHECK:STDERR: let result: i32 = supported + Cpp.unsupported;
845
+
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
846
+
// CHECK:STDERR: fail_import_unsupported_in_instantiation.carbon:[[@LINE+4]]:21: note: in `Cpp` operator `AddWith` lookup [InCppOperatorLookup]
847
+
// CHECK:STDERR: let result: i32 = supported + Cpp.unsupported;
0 commit comments