llvm-project/clang/test/CodeGenCXX/virtual-compare.cpp
Richard Smith 6e73fee780 List implicit operator== after implicit destructors in a vtable.
Summary:
We previously listed first declared members, then implicit operator=,
then implicit operator==, then implicit destructors. Per discussion on
https://github.com/itanium-cxx-abi/cxx-abi/issues/88, put the implicit
equality comparison operators at the very end, after all special member
functions.

This reinstates add2b7e44ada46f30715b5c48823a9e9e317e0c3, reverted in
commit 89e43f04ba87a0da6e94863db149669c7536486b, with a fix for 32-bit
targets.

Reviewers: rjmccall

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D72897
2020-01-21 15:54:40 -08:00

54 lines
1.3 KiB
C++

// RUN: %clang_cc1 -std=c++2a -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s
#include "Inputs/std-compare.h"
// CHECK: @_ZTV1A =
struct A;
struct X {
// CHECK-SAME: @_ZN1X1xEv
virtual void x();
friend auto operator<=>(X, X) = default;
};
struct Y {
virtual ~Y();
virtual A &operator=(const A &);
friend auto operator<=>(Y, Y) = default;
};
struct A : X, Y {
// CHECK-SAME: @_ZN1A1fEv
virtual void f();
// CHECK-SAME: @_ZNKR1AssERKS_
virtual std::strong_ordering operator<=>(const A &) const & = default;
// CHECK-SAME: @_ZN1A1gEv
virtual void g();
// CHECK-SAME: @_ZNKO1AssERKS_
virtual std::strong_ordering operator<=>(const A &) const && = default;
// CHECK-SAME: @_ZN1A1hEv
virtual void h();
// CHECK-SAME: @_ZN1AaSERKS_
// implicit virtual A &operator=(const A&) = default;
// CHECK-SAME: @_ZN1AD1Ev
// CHECK-SAME: @_ZN1AD0Ev
// implicit virtual ~A();
// CHECK-SAME: @_ZNKR1AeqERKS_
// implicit virtual A &operator==(const A&) const & = default;
// CHECK-SAME: @_ZNKO1AeqERKS_
// implicit virtual A &operator==(const A&) const && = default;
};
// For Y:
// CHECK-SAME: @_ZTI1A
// CHECK-SAME: @_ZThn{{[0-9]*}}_N1AD1Ev
// CHECK-SAME: @_ZThn{{[0-9]*}}_N1AD0Ev
// virtual ~Y();
// CHECK-SAME: @_ZThn{{[0-9]*}}_N1AaSERKS_
// virtual A &operator=(const A &);
void A::f() {}