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
114 lines
4.5 KiB
C++
114 lines
4.5 KiB
C++
// RUN: %clang_cc1 -std=c++98 %s -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected,cxx98
|
|
// RUN: %clang_cc1 -std=c++11 %s -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected,since-cxx11
|
|
// RUN: %clang_cc1 -std=c++14 %s -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected,since-cxx11,since-cxx14
|
|
// RUN: %clang_cc1 -std=c++17 %s -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected,since-cxx11,since-cxx14
|
|
// RUN: %clang_cc1 -std=c++20 %s -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected,since-cxx11,since-cxx14
|
|
// RUN: %clang_cc1 -std=c++23 %s -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected,since-cxx11,since-cxx14
|
|
// RUN: %clang_cc1 -std=c++2c %s -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected,since-cxx11,since-cxx14
|
|
|
|
namespace std {
|
|
__extension__ typedef __SIZE_TYPE__ size_t;
|
|
|
|
template<typename T> struct initializer_list {
|
|
const T *p; size_t n;
|
|
initializer_list(const T *p, size_t n);
|
|
};
|
|
} // namespace std
|
|
|
|
namespace cwg1004 { // cwg1004: 5
|
|
template<typename> struct A {};
|
|
template<typename> struct B1 {};
|
|
template<template<typename> class> struct B2 {};
|
|
template<typename X> void f(); // #cwg1004-f-1
|
|
template<template<typename> class X> void f(); // #cwg1004-f-2
|
|
template<template<typename> class X> void g(); // #cwg1004-g-1
|
|
template<typename X> void g(); // #cwg1004-g-2
|
|
struct C : A<int> {
|
|
B1<A> b1a;
|
|
B2<A> b2a;
|
|
void h() {
|
|
f<A>();
|
|
// expected-error@-1 {{call to 'f' is ambiguous}}
|
|
// expected-note@#cwg1004-f-1 {{candidate function [with X = cwg1004::A<int>]}}
|
|
// expected-note@#cwg1004-f-2 {{candidate function [with X = cwg1004::A]}}
|
|
g<A>();
|
|
// expected-error@-1 {{call to 'g' is ambiguous}}
|
|
// expected-note@#cwg1004-g-1 {{candidate function [with X = cwg1004::A]}}
|
|
// expected-note@#cwg1004-g-2 {{candidate function [with X = cwg1004::A<int>]}}
|
|
}
|
|
};
|
|
|
|
// This example (from the standard) is actually ill-formed, because
|
|
// name lookup of "T::template A" names the constructor.
|
|
template<class T, template<class> class U = T::template A> struct Third { };
|
|
// expected-error@-1 {{ISO C++ specifies that qualified reference to 'A' is a constructor name rather than a template name in this context, despite preceding 'typename' keyword}}
|
|
// cxx98-note@#cwg1004-t {{in instantiation of default argument for 'Third<A<int> >' required here}}
|
|
// since-cxx11-note@#cwg1004-t {{in instantiation of default argument for 'Third<A<int>>' required here}}
|
|
Third<A<int> > t; // #cwg1004-t
|
|
} // namespace cwg1004
|
|
|
|
namespace cwg1042 { // cwg1042: 3.5
|
|
#if __cplusplus >= 201402L
|
|
// C++14 added an attribute that we can test the semantics of.
|
|
using foo [[deprecated]] = int; // #cwg1042-using
|
|
foo f = 12;
|
|
// since-cxx14-warning@-1 {{'foo' is deprecated}}
|
|
// since-cxx14-note@#cwg1042-using {{'foo' has been explicitly marked deprecated here}}
|
|
#elif __cplusplus >= 201103L
|
|
// C++11 did not have any attributes that could be applied to an alias
|
|
// declaration, so the best we can test is that we accept an empty attribute
|
|
// list in this mode.
|
|
using foo [[]] = int;
|
|
#endif
|
|
} // namespace cwg1042
|
|
|
|
namespace cwg1048 { // cwg1048: 3.6
|
|
struct A {};
|
|
const A f();
|
|
A g();
|
|
typedef const A CA;
|
|
#if __cplusplus >= 201103L
|
|
// ok: we deduce non-const A in each case.
|
|
A &&a = [] (int n) {
|
|
while (1) switch (n) {
|
|
case 0: return f();
|
|
case 1: return g();
|
|
case 2: return A();
|
|
case 3: return CA();
|
|
}
|
|
} (0);
|
|
#endif
|
|
} // namespace cwg1048
|
|
|
|
namespace cwg1054 { // cwg1054: no
|
|
// FIXME: Test is incomplete.
|
|
struct A {} volatile a;
|
|
void f() {
|
|
// FIXME: This is wrong: an lvalue-to-rvalue conversion is applied here,
|
|
// which copy-initializes a temporary from 'a'. Therefore this is
|
|
// ill-formed because A does not have a volatile copy constructor.
|
|
// (We might want to track this aspect under cwg1383 instead?)
|
|
a;
|
|
// expected-warning@-1 {{expression result unused; assign into a variable to force a volatile load}}
|
|
}
|
|
} // namespace cwg1054
|
|
|
|
namespace cwg1070 { // cwg1070: 3.5
|
|
#if __cplusplus >= 201103L
|
|
struct A {
|
|
A(std::initializer_list<int>);
|
|
};
|
|
struct B {
|
|
int i;
|
|
A a;
|
|
};
|
|
B b = {1};
|
|
struct C {
|
|
std::initializer_list<int> a;
|
|
B b;
|
|
std::initializer_list<double> c;
|
|
};
|
|
C c = {};
|
|
#endif
|
|
} // namespace cwg1070
|