mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-12 01:18:53 +00:00
af682f0df8
https://reviews.llvm.org/D130791 added an improvement that in case array element has a trivial constructor, it is evaluated once and the result is re-used for remaining elements. Make sure the constructor is evaluated for single-elements arrays too. Fixes https://github.com/llvm/llvm-project/issues/60803 Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D145486
20 lines
347 B
C++
20 lines
347 B
C++
// RUN: %clang_cc1 -std=c++20 -verify %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());
|