Debian Codegraph @

clang/test/SemaCXX/constexpr-single-element-array.cpp

raw
1 // RUN: %clang_cc1 -std=c++20 -verify %s
2 // RUN: %clang_cc1 -std=c++20 -verify -fexperimental-new-constant-interpreter %s
3
4
5 // This test makes sure that a single element array doesn't produce
6 // spurious errors during constexpr evaluation.
7
8 // expected-no-diagnostics
9 struct Sub { int x; };
10
11 struct S {
12 constexpr S() { Arr[0] = Sub{}; }
13 Sub Arr[1];
14 };
15
16 constexpr bool test() {
17 S s;
18 return true;
19 }
20
21 static_assert(test());