bolt/deps/llvm-18.1.8/clang/test/SemaCXX/constexpr-single-element-array.cpp
2025-02-14 19:21:04 +01:00

21 lines
429 B
C++

// RUN: %clang_cc1 -std=c++20 -verify %s
// RUN: %clang_cc1 -std=c++20 -verify -fexperimental-new-constant-interpreter %s
// This test makes sure that a single element array doesn't produce
// spurious errors during constexpr evaluation.
// expected-no-diagnostics
struct Sub { int x; };
struct S {
constexpr S() { Arr[0] = Sub{}; }
Sub Arr[1];
};
constexpr bool test() {
S s;
return true;
}
static_assert(test());