blob: cdad62ca440be3dee7fb299065b952a9bf03f675 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
// { dg-do compile { target c++20 } }
template <class T>
concept Destructible = false;
template <class T, class...Args>
concept ConstructibleObject =
// Concept evaluation should short-circuit even the template
// substitution, so we shouldn't even substitute into the requires
// constraint and the unimplemented multi-dimensional new T{...}
// initialization. ATM we do, but as long as we don't output the
// sorry() message we used to for such constructs when asked not
// to issue errors, this shouldn't be a problem for this and
// similar cases.
Destructible<T> && requires (Args&&...args) {
new T{ (Args&&)args... };
};
int main() {
using T = int[2][2];
// GCC has not implemented initialization of multi-dimensional
// arrays with new{} expressions.
static_assert(!ConstructibleObject<T, T>);
}
|