aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1z/using9.C
blob: 98e36babb01cbec4ba550e091773df355a4c03c9 (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
/* { dg-do compile { target c++17 } } */
// Created for c++ PR19377

class A2
{
  protected:
  int separate(int a);
  int separate(int a, int b);
  int separate(int a, int b, int c);
  int comma(int a);
  int alone;
};

class A1
{
  protected:
  int separate();
  int comma();
};

class A3
{
  protected:
  int comma(int a, int b);
};

class B:private A3, private A1, private A2
{
  // Using decls in a comma-separated list.
  using A2::comma, A3::comma, A1::comma;  // { dg-message "declared" }
  // Separate using statements.
  using A2::separate; // { dg-message "declared" }
  using A1::separate; // { dg-message "declared" }
  // No ambiguity, just for the sake of it.
  using A2::alone; // { dg-message "declared" }
};

class C:public B
{
  void f()
  {
    comma(); // { dg-error "private" }
    separate(); // { dg-error "private" }
    separate(1); // { dg-error "private" }
    separate(1, 2); // { dg-error "private" }
    separate(1, 2, 3); // { dg-error "private" }
    alone = 5; // { dg-error "private" }
  }
};