| 1 |
// Test that non-aggregates don't get the aggregate deduction. |
| 2 |
// { dg-do compile { target c++20 } } |
| 3 |
// { dg-prune-output "no matching function" } |
| 4 |
|
| 5 |
struct A { A(); }; |
| 6 |
|
| 7 |
template <typename T> |
| 8 |
struct S1 { |
| 9 |
T x; |
| 10 |
}; |
| 11 |
|
| 12 |
S1 s1 = {1}; // OK |
| 13 |
|
| 14 |
template <typename T> |
| 15 |
struct S2 { |
| 16 |
S2 (); |
| 17 |
T x; |
| 18 |
}; |
| 19 |
|
| 20 |
S2 s2 = {1}; // { dg-error "deduction failed" } |
| 21 |
|
| 22 |
template <typename T> |
| 23 |
struct S3 { |
| 24 |
private: |
| 25 |
T x; |
| 26 |
}; |
| 27 |
|
| 28 |
S3 s3 = {1}; // { dg-error "deduction failed" } |
| 29 |
|
| 30 |
template <typename T> |
| 31 |
struct S4 { |
| 32 |
virtual void f(); |
| 33 |
T x; |
| 34 |
}; |
| 35 |
|
| 36 |
S4 s4 = {1}; // { dg-error "deduction failed" } |
| 37 |
|
| 38 |
template <typename T> |
| 39 |
struct S5: public A { |
| 40 |
using A::A; |
| 41 |
T x; |
| 42 |
}; |
| 43 |
|
| 44 |
S5 s5 = {1}; // { dg-error "deduction failed" } |
| 45 |
|
| 46 |
template <typename T> |
| 47 |
struct S6: virtual A { |
| 48 |
T x; |
| 49 |
}; |
| 50 |
|
| 51 |
S6 s6 = {1}; // { dg-error "deduction failed" } |
| 52 |
|