Files
TheRock/compiler/amd-llvm/clang/test/SemaCXX/single-element-init-list.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

83 lines
2.0 KiB
C++

// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify %s
// This is heavily affected by the speculative resolution applied to CWG2311
// So behaviour shown here is subject to change.
// expected-no-diagnostics
namespace std {
typedef decltype(sizeof(int)) size_t;
// libc++'s implementation
template <class _E>
class initializer_list
{
const _E* __begin_;
size_t __size_;
initializer_list(const _E* __b, size_t __s)
: __begin_(__b),
__size_(__s)
{}
public:
typedef _E value_type;
typedef const _E& reference;
typedef const _E& const_reference;
typedef size_t size_type;
typedef const _E* iterator;
typedef const _E* const_iterator;
constexpr initializer_list() : __begin_(nullptr), __size_(0) {}
constexpr size_t size() const {return __size_;}
const _E* begin() const {return __begin_;}
const _E* end() const {return __begin_ + __size_;}
};
template<typename T>
struct vector {
size_t sz;
constexpr vector() : sz(0) {}
constexpr vector(initializer_list<T> ilist) : sz(ilist.size()) {}
constexpr vector(const vector& other) : sz(other.sz) {}
constexpr std::size_t size() const { return sz; }
};
}
// https://github.com/llvm/llvm-project/pull/77768#issuecomment-1908062472
namespace Issue1 {
struct A {
constexpr A() {}
};
struct B {
int called_ctor;
constexpr explicit B(A) : called_ctor(0) {}
constexpr explicit B(std::vector<A>) : called_ctor(1) {}
};
struct C {
B b;
constexpr C() : b({A()}) {}
};
static_assert(C().b.called_ctor == 0);
}
// https://github.com/llvm/llvm-project/pull/77768#issuecomment-1957171805
namespace Issue2 {
struct A {
constexpr A(int x_) {}
constexpr A(const std::vector<A>& a) {}
};
void f() {
constexpr std::vector<A> a{1,2};
constexpr std::vector<A> b{a};
// -> constexpr std::vector<A> b(std::initializer_list<A>{ A(a) });
static_assert(b.size() == 1);
}
}