llvm-project/clang/test/FixIt/fixit-defaulted-comparison.cpp
NeKon69 d3224dc5da
[clang][Sema] Fix const FixIt placement after comparison operator member definition (#188093)
Update `InsertLoc` to use the token after the closing parenthesis
when adding `const` qualification to a comparison operator

Fixes #187887
2026-03-31 00:56:00 -04:00

19 lines
776 B
C++

// RUN: %clang_cc1 -verify -std=c++23 %s
// RUN: cp %s %t
// RUN: not %clang_cc1 -std=c++23 -x c++ -fixit %t
// RUN: %clang_cc1 -std=c++23 -x c++ %t
// RUN: not %clang_cc1 -std=c++23 -x c++ -fsyntax-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
namespace std {
struct partial_ordering {};
} // namespace std
struct Box {
std::partial_ordering operator<=>(const Box& other) = default; // #ssdecl
bool operator==(const Box& other) = default; // #eqdecl
// expected-error@#ssdecl {{defaulted member three-way comparison operator must be const-qualified}}
// expected-error@#eqdecl {{defaulted member equality comparison operator must be const-qualified}}
// CHECK: fix-it:{{.*}}:{12:54-12:54}:" const"
// CHECK: fix-it:{{.*}}:{13:36-13:36}:" const"
};