Files
TheRock/compiler/amd-llvm/clang/test/SemaCXX/diagnostic-order.cpp
T
derek.holloway 7502bf64a4
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
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

74 lines
2.5 KiB
C++

// RUN: not %clang_cc1 -std=c++11 %s -fsyntax-only 2>&1 | FileCheck %s
// RUN: %clang_cc1 -std=c++11 %s -fsyntax-only -DWARN 2>&1 | FileCheck %s --check-prefix=CHECK-WARN
#ifndef WARN
// Ensure that the diagnostics we produce for this situation appear in a
// deterministic order. This requires ADL to provide lookup results in a
// deterministic order.
template<typename T, typename> struct Error { typedef typename T::error error; };
struct X { template<typename T> friend typename Error<X, T>::error f(X, T); };
struct Y { template<typename T> friend typename Error<Y, T>::error f(T, Y); };
void g() {
f(X(), Y());
}
// We don't really care which order these two diagnostics appear (although the
// order below is source order, which seems best). The crucial fact is that
// there is one single order that is stable across multiple runs of clang.
//
// CHECK: no type named 'error' in 'X'
// CHECK: no type named 'error' in 'Y'
// CHECK: no matching function for call to 'f'
struct Oper {
template<typename T, typename U = typename Error<Oper, T>::error> operator T();
operator int*();
operator float*();
operator X*();
operator Y*();
operator int(*[1])();
operator int(*[2])();
operator int(*[3])();
operator int(*[4])();
operator int(*[5])();
operator int(*[6])();
operator int(*[7])();
operator int(*[8])();
operator float(*[1])();
operator float(*[2])();
operator float(*[3])();
operator float(*[4])();
operator float(*[5])();
operator float(*[6])();
operator float(*[7])();
operator float(*[8])();
};
int *p = Oper() + 0;
// CHECK: no type named 'error' in 'Oper'
// CHECK: in instantiation of template class 'Error<Oper, int *>'
// CHECK: no type named 'error' in 'Oper'
// CHECK: in instantiation of template class 'Error<Oper, float *>'
// CHECK: no type named 'error' in 'Oper'
// CHECK: in instantiation of template class 'Error<Oper, X *>'
// CHECK: no type named 'error' in 'Oper'
// CHECK: in instantiation of template class 'Error<Oper, Y *>'
#endif
template<typename T> struct UndefButUsed {
static inline int f();
static int g() { return f(); }
};
int undef_but_used = UndefButUsed<int>::g() + UndefButUsed<float>::g() + UndefButUsed<char>::g() + UndefButUsed<void>::g();
// CHECK-WARN: inline function 'UndefButUsed<int>::f' is not defined
// CHECK-WARN: inline function 'UndefButUsed<float>::f' is not defined
// CHECK-WARN: inline function 'UndefButUsed<char>::f' is not defined
// CHECK-WARN: inline function 'UndefButUsed<void>::f' is not defined