summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/class-deduction-aggr2.C
blob: 896554f610a55b20f5fd028a4ec79508181b15cc (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Test that non-aggregates don't get the aggregate deduction.
// { dg-do compile { target c++2a } }
// { dg-prune-output "no matching function" }

struct A { A(); };

template <typename T>
struct S1 {
  T x;
};

S1 s1 = {1};			// OK

template <typename T>
struct S2 {
  S2 ();
  T x;
};

S2 s2 = {1};			// { dg-error "deduction failed" }

template <typename T>
struct S3 {
private:
  T x;
};

S3 s3 = {1};			// { dg-error "deduction failed" }

template <typename T>
struct S4 {
  virtual void f();
  T x;
};

S4 s4 = {1};			// { dg-error "deduction failed" }

template <typename T>
struct S5: public A {
  using A::A;
  T x;
};

S5 s5 = {1};			// { dg-error "deduction failed" }

template <typename T>
struct S6: virtual A {
  T x;
};

S6 s6 = {1};			// { dg-error "deduction failed" }