blob: f94a84bba064d7f4b46c916bdd5d5a4cdf591926 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
// 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());
|