[AArch64/arm] PR testsuite/85326 Avoid C++ tests when C++ compiler not present
[official-gcc.git] / gcc / testsuite / g++.dg / concepts / pr71965.C
blob6bfaef19211fa0d76cc2ab3b930836e70ecc70e3
1 // { dg-do compile { target c++14 } }
2 // { dg-options "-fconcepts" }
4 template <class T>
5 concept bool Destructible() {
6     return false;
9 template <class T, class...Args>
10 concept bool ConstructibleObject =
11     // Concept evaluation should short-circuit even the template
12     // substitution, so we shouldn't even substitute into the requires
13     // constraint and the unimplemented multi-dimensional new T{...}
14     // initialization.  ATM we do, but as long as we don't output the
15     // sorry() message we used to for such constructs when asked not
16     // to issue errors, this shouldn't be a problem for this and
17     // similar cases.
18     Destructible<T>() && requires (Args&&...args) {
19         new T{ (Args&&)args... };
20     };
22 int main() {
23     using T = int[2][2];
24     // GCC has not implemented initialization of multi-dimensional
25     // arrays with new{} expressions.
26     static_assert(!ConstructibleObject<T, T>);