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
Set the location for the candidate set when looking up C++ operators (#6138)
This adds location information and prevents crashes in some cases of
template instantiation in operator lookup.
Removed `InCppOperatorLookup` note as it is no longer necessary.
Part of #5995.
// CHECK:STDERR: fail_import_incomplete_unary.carbon:[[@LINE+11]]:27: error: looking up a C++ operator with incomplete operand type `Cpp.Incomplete` [IncompleteOperandTypeInCppOperatorLookup]
767
+
// CHECK:STDERR: fail_import_incomplete_unary.carbon:[[@LINE+8]]:27: error: looking up a C++ operator with incomplete operand type `Cpp.Incomplete` [IncompleteOperandTypeInCppOperatorLookup]
774
768
// CHECK:STDERR: let result_unary: i32 = -*Cpp.CreateIncomplete();
775
769
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~
776
770
// CHECK:STDERR: fail_import_incomplete_unary.carbon:[[@LINE-6]]:10: in file included here [InCppInclude]
777
771
// CHECK:STDERR: ./incomplete.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere]
778
772
// CHECK:STDERR: class Incomplete;
779
773
// CHECK:STDERR: ^
780
-
// CHECK:STDERR: fail_import_incomplete_unary.carbon:[[@LINE+4]]:27: note: in `Cpp` operator `Negate` lookup [InCppOperatorLookup]
781
-
// CHECK:STDERR: let result_unary: i32 = -*Cpp.CreateIncomplete();
var complete: Cpp.Complete= Cpp.Complete.Complete();
795
-
// CHECK:STDERR: fail_import_incomplete_binary.carbon:[[@LINE+11]]:28: error: looking up a C++ operator with incomplete operand type `Cpp.Incomplete` [IncompleteOperandTypeInCppOperatorLookup]
786
+
// CHECK:STDERR: fail_import_incomplete_binary.carbon:[[@LINE+8]]:28: error: looking up a C++ operator with incomplete operand type `Cpp.Incomplete` [IncompleteOperandTypeInCppOperatorLookup]
796
787
// CHECK:STDERR: let result_binary: i32 = complete + *Cpp.CreateIncomplete();
var complete: Cpp.Complete= Cpp.Complete.Complete();
828
-
// CHECK:STDERR: fail_incomplete_operand_carbon_type.carbon:[[@LINE+10]]:21: error: looking up a C++ operator with incomplete operand type `Incomplete` [IncompleteOperandTypeInCppOperatorLookup]
816
+
// CHECK:STDERR: fail_incomplete_operand_carbon_type.carbon:[[@LINE+7]]:21: error: looking up a C++ operator with incomplete operand type `Incomplete` [IncompleteOperandTypeInCppOperatorLookup]
829
817
// CHECK:STDERR: let result: i32 = *CreateIncomplete() + complete;
830
818
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
831
819
// CHECK:STDERR: fail_incomplete_operand_carbon_type.carbon:[[@LINE-8]]:1: note: class was forward declared here [ClassForwardDeclaredHere]
832
820
// CHECK:STDERR: class Incomplete;
833
821
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
834
-
// CHECK:STDERR: fail_incomplete_operand_carbon_type.carbon:[[@LINE+4]]:21: note: in `Cpp` operator `AddWith` lookup [InCppOperatorLookup]
835
-
// CHECK:STDERR: let result: i32 = *CreateIncomplete() + complete;
// CHECK:STDERR: let result: i32 = -Cpp.unsupported;
863
-
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
864
-
// CHECK:STDERR: fail_import_unsupported_in_instantiation_unary.carbon:[[@LINE+7]]:21: note: while completing C++ type `Cpp.Unsupported` [InCppTypeCompletion]
// CHECK:STDERR: let result: i32 = -Cpp.unsupported;
866
848
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
867
-
// CHECK:STDERR: fail_import_unsupported_in_instantiation_unary.carbon:[[@LINE+4]]:21: note: in `Cpp` operator `Negate` lookup [InCppOperatorLookup]
849
+
// CHECK:STDERR: fail_import_unsupported_in_instantiation_unary.carbon:[[@LINE+4]]:21: note: while completing C++ type `Cpp.Unsupported` [InCppTypeCompletion]
868
850
// CHECK:STDERR: let result: i32 = -Cpp.unsupported;
// CHECK:STDERR: let result: i32 = supported + Cpp.unsupported;
884
866
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
885
-
// CHECK:STDERR: fail_import_unsupported_in_instantiation_binary.carbon:[[@LINE+7]]:21: note: while completing C++ type `Cpp.Unsupported` [InCppTypeCompletion]
886
-
// CHECK:STDERR: let result: i32 = supported + Cpp.unsupported;
887
-
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
888
-
// CHECK:STDERR: fail_import_unsupported_in_instantiation_binary.carbon:[[@LINE+4]]:21: note: in `Cpp` operator `AddWith` lookup [InCppOperatorLookup]
867
+
// CHECK:STDERR: fail_import_unsupported_in_instantiation_binary.carbon:[[@LINE+4]]:21: note: while completing C++ type `Cpp.Unsupported` [InCppTypeCompletion]
889
868
// CHECK:STDERR: let result: i32 = supported + Cpp.unsupported;
// CHECK:STDERR: fail_indirect_template_instantiation_error.carbon:[[@LINE+3]]:19: error: type 'int' cannot be used prior to '::' because it has no members [CppInteropParseError]
// CHECK:STDERR: fail_indirect_template_instantiation_error.carbon:[[@LINE+8]]:12: note: in instantiation of template class 'A<int>' requested here [CppInteropParseNote]
918
+
// CHECK:STDERR: 25 | return x + x;
919
+
// CHECK:STDERR: | ^
920
+
// CHECK:STDERR:
921
+
// CHECK:STDERR: fail_indirect_template_instantiation_error.carbon:[[@LINE+4]]:12: error: no matching function for call to '<C++ operator>' [CppInteropParseError]
0 commit comments