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