| 1 |
// PR c++/20420 |
| 2 |
// FIXME: These error messages aren't great, rather than multiple definition |
| 3 |
// we should talk about conflicting declarations with the using-decl. |
| 4 |
|
| 5 |
class B |
| 6 |
{ |
| 7 |
protected: |
| 8 |
enum E { E1, E2, E3 }; // { dg-message "previous" } |
| 9 |
struct S { int i; E e; }; // { dg-message "previous" } |
| 10 |
}; |
| 11 |
|
| 12 |
class D : private B |
| 13 |
{ |
| 14 |
public: |
| 15 |
using B::E; |
| 16 |
using B::S; |
| 17 |
|
| 18 |
private: |
| 19 |
enum E {}; // { dg-error "multiple definition" } |
| 20 |
struct S {}; // { dg-error "redefinition" } |
| 21 |
}; |
| 22 |
|
| 23 |
template<typename T> |
| 24 |
class BT |
| 25 |
{ |
| 26 |
protected: |
| 27 |
enum E { E1, E2, E3 }; |
| 28 |
struct S { int i; E e; }; |
| 29 |
}; |
| 30 |
|
| 31 |
template<typename T> |
| 32 |
class DT : private BT<T> |
| 33 |
{ |
| 34 |
public: |
| 35 |
using BT<T>::E; // { dg-message "previous" "PR c++/115806" { xfail *-*-* } } |
| 36 |
using BT<T>::S; // { dg-message "previous" } |
| 37 |
|
| 38 |
private: |
| 39 |
enum E {}; // { dg-error "conflicts" "PR c++/115806" { xfail *-*-* } } |
| 40 |
struct S {}; // { dg-error "conflicts" } |
| 41 |
}; |
| 42 |
|
| 43 |
template class DT<int>; |
| 44 |
|
| 45 |
namespace N |
| 46 |
{ |
| 47 |
int i; |
| 48 |
enum bob {Q}; |
| 49 |
} |
| 50 |
|
| 51 |
void |
| 52 |
f () |
| 53 |
{ |
| 54 |
using N::i; |
| 55 |
using N::i; // { dg-bogus "conflicts" "See P1787 (CWG36)" } |
| 56 |
} |