| 1 |
// Test of using an enumerator. |
| 2 |
// { dg-do compile { target c++2a } } |
| 3 |
|
| 4 |
// using ENUM::V; |
| 5 |
enum class E {v}; |
| 6 |
|
| 7 |
using E::v; |
| 8 |
using E::v; // OK |
| 9 |
|
| 10 |
E a = v; |
| 11 |
|
| 12 |
class C |
| 13 |
{ |
| 14 |
using E::v; // { dg-message "declared private here" } |
| 15 |
|
| 16 |
static inline const E m = v; |
| 17 |
}; |
| 18 |
|
| 19 |
E b = C::v; // { dg-error "private" } |
| 20 |
|
| 21 |
struct B |
| 22 |
{ |
| 23 |
enum E {e}; |
| 24 |
enum class EC {f}; |
| 25 |
using EC::f; |
| 26 |
}; |
| 27 |
|
| 28 |
struct D |
| 29 |
{ |
| 30 |
private: |
| 31 |
using B::e; // { dg-message "declared private here" } |
| 32 |
using B::f; // { dg-message "declared private here" } |
| 33 |
}; |
| 34 |
|
| 35 |
struct F : D |
| 36 |
{ |
| 37 |
static inline const auto bad1 = e; // { dg-error "private" } |
| 38 |
static inline const auto bad2 = f; // { dg-error "private" } |
| 39 |
|
| 40 |
static inline const auto ok1 = B::e; |
| 41 |
static inline const auto ok2 = B::f; |
| 42 |
static inline const auto also_ok1 = B::E::e; |
| 43 |
static inline const auto also_ok2 = B::EC::f; |
| 44 |
}; |
| 45 |
|
| 46 |
using B::e; |
| 47 |
auto bob = e; |
| 48 |
|
| 49 |
struct Q |
| 50 |
{ |
| 51 |
using B::e; |
| 52 |
}; |
| 53 |
using Q::e; // OK |
| 54 |
|
| 55 |
using D::e; // { dg-error "private" } |
| 56 |
|
| 57 |
template <class T> |
| 58 |
struct X : T |
| 59 |
{ |
| 60 |
using T::e; |
| 61 |
}; |
| 62 |
auto fob = X<Q>::e; |