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
188 lines
5.1 KiB
C++
188 lines
5.1 KiB
C++
// RUN: %clang_cc1 -std=c++98 -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected,cxx98 %s
|
|
// RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected,since-cxx11 %s
|
|
// RUN: %clang_cc1 -std=c++14 -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected,since-cxx11 %s
|
|
// RUN: %clang_cc1 -std=c++17 -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected,since-cxx11 %s
|
|
// RUN: %clang_cc1 -std=c++20 -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected,since-cxx11,since-cxx20 %s
|
|
// RUN: %clang_cc1 -std=c++23 -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected,since-cxx11,since-cxx20,since-cxx23 %s
|
|
// RUN: %clang_cc1 -std=c++2c -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected,since-cxx11,since-cxx20,since-cxx23,since-cxx26 %s
|
|
|
|
// cxx98-no-diagnostics
|
|
|
|
namespace cwg2913 { // cwg2913: 20
|
|
|
|
#if __cplusplus >= 202002L
|
|
|
|
template<typename T>
|
|
struct R {
|
|
R(T);
|
|
R(T, T);
|
|
};
|
|
|
|
template<typename T>
|
|
R(T) -> R<T> requires true;
|
|
|
|
template<typename T>
|
|
R(T, T) requires true -> R<T>;
|
|
// since-cxx20-error@-1 {{expected function body after function declarator}}
|
|
|
|
#endif
|
|
|
|
} // namespace cwg2913
|
|
|
|
namespace cwg2915 { // cwg2915: 20
|
|
#if __cplusplus >= 202302L
|
|
struct A {
|
|
void f(this void);
|
|
// since-cxx23-error@-1 {{explicit object parameter cannot have 'void' type}}
|
|
};
|
|
#endif
|
|
} // namespace cwg2915
|
|
|
|
namespace cwg2917 { // cwg2917: 20
|
|
#if __cplusplus >= 201103L
|
|
template <typename>
|
|
class Foo;
|
|
|
|
template<class ...>
|
|
struct C {
|
|
struct Nested { };
|
|
};
|
|
|
|
struct S {
|
|
template <typename>
|
|
friend class Foo, int;
|
|
// since-cxx11-error@-1 {{a friend declaration that befriends a template must contain exactly one type-specifier}}
|
|
|
|
template <typename ...Ts>
|
|
friend class C<Ts>::Nested...;
|
|
// since-cxx11-error@-1 {{friend declaration expands pack 'Ts' that is declared it its own template parameter list}}
|
|
};
|
|
#endif
|
|
} // namespace cwg2917
|
|
|
|
namespace cwg2918 { // cwg2918: 21
|
|
|
|
#if __cplusplus >= 202002L
|
|
|
|
namespace Example1 {
|
|
|
|
template<bool B> struct X {
|
|
void f(short) requires B;
|
|
void f(long);
|
|
template<typename> void g(short) requires B;
|
|
template<typename> void g(long);
|
|
};
|
|
|
|
void test() {
|
|
&X<true>::f;
|
|
// since-cxx20-error@-1 {{reference to overloaded function could not be resolved; did you mean to call it?}}
|
|
&X<true>::g<int>;
|
|
// since-cxx20-error@-1 {{reference to overloaded function could not be resolved; did you mean to call it?}}
|
|
}
|
|
|
|
} // namespace Example1
|
|
|
|
namespace Example2 {
|
|
|
|
template <bool B> struct X {
|
|
static constexpr int f(short) requires B {
|
|
return 42;
|
|
}
|
|
static constexpr int f(short) {
|
|
return 24;
|
|
}
|
|
};
|
|
|
|
template <typename T>
|
|
constexpr int f(T) { return 1; }
|
|
|
|
template <typename T>
|
|
requires __is_same(T, int)
|
|
constexpr int f(T) { return 2; }
|
|
|
|
void test() {
|
|
constexpr auto x = &X<true>::f;
|
|
static_assert(__is_same(decltype(x), int(*const)(short)), "");
|
|
static_assert(x(0) == 42, "");
|
|
|
|
constexpr auto y = &X<false>::f;
|
|
static_assert(__is_same(decltype(y), int(*const)(short)));
|
|
static_assert(y(0) == 24, "");
|
|
|
|
constexpr auto z = &f<int>;
|
|
static_assert(__is_same(decltype(z), int(*const)(int)));
|
|
static_assert(z(0) == 2, "");
|
|
|
|
// C++ [temp.deduct.call]p6:
|
|
// If the argument is an overload set containing one or more function templates,
|
|
// the parameter is treated as a non-deduced context.
|
|
auto w = f; // since-cxx20-error {{variable 'w' with type 'auto' has incompatible initializer of type '<overloaded function type>'}}
|
|
}
|
|
|
|
} // namespace Example2
|
|
#endif
|
|
|
|
#if __cplusplus >= 201103L
|
|
namespace Example3 {
|
|
|
|
template <typename T> void f(T &&, void (*)(T &&)); // #cwg2918_f
|
|
|
|
void g(int &);
|
|
inline namespace A {
|
|
void g(short &&);
|
|
}
|
|
inline namespace B {
|
|
void g(short &&);
|
|
}
|
|
|
|
void q() {
|
|
int x;
|
|
f(x, g);
|
|
// since-cxx11-error@-1 {{no matching function for call to 'f'}}
|
|
// since-cxx11-note@#cwg2918_f {{candidate template ignored: deduced conflicting types for parameter 'T' ('int &' vs. 'short')}}
|
|
}
|
|
|
|
} // namespace Example3
|
|
|
|
#endif
|
|
|
|
} // namespace cwg2918
|
|
|
|
#if __cplusplus > 202302L
|
|
namespace std {
|
|
using size_t = decltype(sizeof(0));
|
|
} // namespace std
|
|
void *operator new(std::size_t, void *p) { return p; }
|
|
void* operator new[] (std::size_t, void* p) {return p; }
|
|
#endif
|
|
|
|
namespace cwg2922 { // cwg2922: 20
|
|
#if __cplusplus > 202302L
|
|
union U { int a, b; };
|
|
constexpr U nondeterministic(bool i) {
|
|
if(i) {
|
|
U u;
|
|
new (&u) int(); // #cwg2922-placement-new
|
|
return u;
|
|
}
|
|
return {};
|
|
}
|
|
constexpr U _ = nondeterministic(true);
|
|
// since-cxx26-error@-1 {{constexpr variable '_' must be initialized by a constant expression}}
|
|
// since-cxx26-note@#cwg2922-placement-new {{placement new would change type of storage from 'U' to 'int'}}
|
|
// since-cxx26-note@-3 {{in call to 'nondeterministic(true)'}}
|
|
#endif
|
|
} // namespace cwg2922
|
|
|
|
// cwg2947 is in cwg2947.cpp
|
|
|
|
namespace cwg2966 { // cwg2966: 2.7
|
|
#if __cplusplus >= 201103L
|
|
static_assert(sizeof(decltype(nullptr)) == sizeof(void*), "");
|
|
static_assert(alignof(decltype(nullptr)) == alignof(void*), "");
|
|
#endif
|
|
} // namespace cwg2966
|
|
|
|
// cwg2983: na
|
|
// cwg2992: na
|