[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / SemaCXX / constexpr-array-init.cpp
blobcb11f47fb3cb8751478a093c39b311b09017f8d2
1 // RUN: %clang_cc1 -std=c++20 -verify %s
3 /// This test case used to crash in constant evaluation
4 /// because of the two-dimensional array with an array
5 /// filler expression.
7 /// expected-no-diagnostics
8 struct Foo {
9 int a;
10 constexpr Foo()
11 : a(get_int()) {
14 constexpr int get_int() const {
15 return 5;
19 static constexpr Foo bar[2][1] = {
20 {{}},
22 static_assert(bar[0][0].a == 5);
23 static_assert(bar[1][0].a == 5);