Files
TheRock/compiler/amd-llvm/clang/test/CXX/except/except.spec/p1.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

97 lines
2.2 KiB
C++

// RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
// Simple parser tests, dynamic specification.
namespace dyn {
struct X { };
struct Y { };
void f() throw() { }
void g(int) throw(X) { }
void h() throw(X, Y) { }
class Class {
void foo() throw (X, Y) { }
};
void (*fptr)() throw();
}
// Simple parser tests, noexcept specification.
namespace noex {
void f1() noexcept { }
void f2() noexcept (true) { }
void f3() noexcept (false) { }
void f4() noexcept (1 < 2) { }
class CA1 {
void foo() noexcept { }
void bar() noexcept (true) { }
};
void (*fptr1)() noexcept;
void (*fptr2)() noexcept (true);
}
namespace mix {
void f() throw(int) noexcept { } // expected-error {{cannot have both}}
void g() noexcept throw(int) { } // expected-error {{cannot have both}}
}
// Sema tests, noexcept specification
namespace noex {
struct A {};
void g1() noexcept(A()); // expected-error {{value of type 'A' is not implicitly convertible to 'bool'}}
void g2(bool b) noexcept(b); // expected-error {{noexcept specifier argument is not a constant expression}} expected-note {{function parameter 'b' with unknown value}} expected-note {{here}}
}
namespace noexcept_unevaluated {
template<typename T> bool f(T) {
T* x = 1;
}
template<typename T>
void g(T x) noexcept((sizeof(T) == sizeof(int)) || noexcept(f(x))) { }
void h() {
g(1);
}
}
namespace PR11084 {
template <int X> struct A {
static int f() noexcept(1 / X) { return 10; } // expected-error{{noexcept specifier argument is not a constant expression}} expected-note{{division by zero}}
};
template<int X> void f() {
int (*p)() noexcept(1 / X); // expected-error{{noexcept specifier argument is not a constant expression}} expected-note{{division by zero}}
};
void g() {
A<0>::f(); // expected-note{{in instantiation of exception specification for 'f'}}
f<0>(); // expected-note{{in instantiation of function template specialization}}
}
}
namespace FuncTmplNoexceptError {
int a = 0;
// expected-error@+1{{noexcept specifier argument is not a constant expression}}
template <class T> T f() noexcept(a++){ return {};}
void g(){
f<int>();
}
};