mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-18 09:26:41 +00:00
22 lines
429 B
C++
22 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());
|