brintos

brintos / llvm-project-archived public Read only

0
0
Text · 444 B · cb11f47 Raw
25 lines · cpp
1// RUN: %clang_cc1 -std=c++20 -verify %s2 3/// This test case used to crash in constant evaluation4/// because of the two-dimensional array with an array5/// filler expression.6 7/// expected-no-diagnostics8struct Foo {9  int a;10  constexpr Foo()11      : a(get_int()) {12  }13 14  constexpr int get_int() const {15    return 5;16  }17};18 19static constexpr Foo bar[2][1] = {20    {{}},21};22static_assert(bar[0][0].a == 5);23static_assert(bar[1][0].a == 5);24 25