CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
133 lines
2.9 KiB
C++
133 lines
2.9 KiB
C++
// RUN: %clang_cc1 -fexceptions -fcxx-exceptions -std=c++11 -triple %itanium_abi_triple -fsyntax-only %s
|
|
// RUN: %clang_cc1 -fexceptions -fcxx-exceptions -std=c++11 -triple %ms_abi_triple -verify %s
|
|
|
|
namespace Test1 {
|
|
|
|
// Should be accepted under the Itanium ABI (first RUN line) but rejected
|
|
// under the Microsoft ABI (second RUN line), as Microsoft ABI requires
|
|
// operator delete() lookups to be done when vtables are marked used.
|
|
|
|
struct A {
|
|
void operator delete(void *); // expected-note {{member found by ambiguous name lookup}}
|
|
};
|
|
|
|
struct B {
|
|
void operator delete(void *); // expected-note {{member found by ambiguous name lookup}}
|
|
};
|
|
|
|
struct C : A, B {
|
|
~C();
|
|
};
|
|
|
|
struct VC : A, B {
|
|
virtual ~VC(); // expected-error {{member 'operator delete' found in multiple base classes of different types}}
|
|
};
|
|
|
|
void f() {
|
|
// This marks VC's vtable used.
|
|
VC vc;
|
|
}
|
|
|
|
}
|
|
|
|
namespace Test2 {
|
|
|
|
// In the MSVC ABI, functions must destroy their aggregate arguments. foo
|
|
// requires a dtor for B, but we can't implicitly define it because ~A is
|
|
// private. bar should be able to call A's private dtor without error, even
|
|
// though MSVC rejects bar.
|
|
class A {
|
|
private:
|
|
~A();
|
|
int a;
|
|
};
|
|
|
|
struct B : public A { // expected-note {{destructor of 'B' is implicitly deleted because base class 'A' has an inaccessible destructor}}
|
|
int b;
|
|
};
|
|
|
|
struct C {
|
|
~C();
|
|
int c;
|
|
};
|
|
|
|
struct D {
|
|
// D has a non-trivial implicit dtor that destroys C.
|
|
C o;
|
|
};
|
|
|
|
void foo(B b) { } // expected-error {{attempt to use a deleted function}}
|
|
void bar(A a) { } // no error; MSVC rejects this, but we skip the direct access check.
|
|
void baz(D d) { } // no error
|
|
|
|
}
|
|
|
|
#ifdef MSVC_ABI
|
|
namespace Test3 {
|
|
|
|
class A {
|
|
A();
|
|
~A(); // expected-note {{implicitly declared private here}}
|
|
friend void bar(A);
|
|
int a;
|
|
};
|
|
|
|
void bar(A a) { }
|
|
void baz(A a) { } // no error; MSVC rejects this, but the standard allows it.
|
|
|
|
// MSVC accepts foo() but we reject it for consistency with Itanium. MSVC also
|
|
// rejects this if A has a copy ctor or if we call A's ctor.
|
|
void foo(A *a) {
|
|
bar(*a); // expected-error {{temporary of type 'Test3::A' has private destructor}}
|
|
}
|
|
}
|
|
#endif
|
|
|
|
namespace Test4 {
|
|
// Don't try to access the dtor of an incomplete on a function declaration.
|
|
class A;
|
|
void foo(A a);
|
|
}
|
|
|
|
#ifdef MSVC_ABI
|
|
namespace Test5 {
|
|
// Do the operator delete access control check from the context of the dtor.
|
|
class A {
|
|
protected:
|
|
void operator delete(void *);
|
|
};
|
|
class B : public A {
|
|
virtual ~B();
|
|
};
|
|
B *test() {
|
|
// Previously, marking the vtable used here would do the operator delete
|
|
// lookup from this context, which doesn't have access.
|
|
return new B;
|
|
}
|
|
}
|
|
#endif
|
|
|
|
namespace Test6 {
|
|
class A {
|
|
protected:
|
|
void operator delete(void *);
|
|
};
|
|
class B : public A {
|
|
virtual ~B();
|
|
public:
|
|
virtual void m_fn1();
|
|
};
|
|
void fn1(B *b) { b->m_fn1(); }
|
|
}
|
|
|
|
namespace Test7 {
|
|
class A {
|
|
protected:
|
|
void operator delete(void *);
|
|
};
|
|
struct B : public A {
|
|
virtual ~B();
|
|
};
|
|
void fn1(B b) {}
|
|
}
|