Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / SemaCXX / cxx20-default-compare.cpp
blob7074ee885ac4a21245a524167a8db550b239c600
1 // RUN: %clang_cc1 %s -std=c++23 -verify -Wfloat-equal
3 struct Foo {
4 float val;
5 bool operator==(const Foo &) const;
6 friend bool operator==(const Foo &, const Foo &);
7 friend bool operator==(Foo, Foo );
8 };
10 // Declare the defaulted comparison function as a member function.
11 bool Foo::operator==(const Foo &) const = default; // expected-warning {{comparing floating point with == or != is unsafe}} expected-note {{in defaulted equality comparison operator for 'Foo' first required here}}
13 // Declare the defaulted comparison function as a non-member function.
14 bool operator==(const Foo &, const Foo &) = default; // expected-warning {{comparing floating point with == or != is unsafe}} expected-note {{in defaulted equality comparison operator for 'Foo' first required here}}
16 // Declare the defaulted comparison function as a non-member function. Arguments are passed by value.
17 bool operator==(Foo, Foo) = default; // expected-warning {{comparing floating point with == or != is unsafe}} expected-note {{in defaulted equality comparison operator for 'Foo' first required here}}