| 1 |
// PR c++/89537 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
template <typename> class A {}; |
| 5 |
template <typename, typename, typename, typename> class B; |
| 6 |
class C { |
| 7 |
using mapped_type = int; |
| 8 |
|
| 9 |
public: |
| 10 |
template <typename _Compare> |
| 11 |
C(B<mapped_type, _Compare, A<int>, A<int>> *p1, unsigned) |
| 12 |
: keys(p1->keys), // { dg-error "18: invalid use of non-static member function" } |
| 13 |
values(p1->values) {} // { dg-error "20: invalid use of non-static member function" } |
| 14 |
A<int> keys; |
| 15 |
A<int> values; |
| 16 |
}; |
| 17 |
class D { |
| 18 |
public: |
| 19 |
using key_compare = int; |
| 20 |
template <typename _Alloc> D(key_compare, _Alloc); |
| 21 |
}; |
| 22 |
template <typename _Tp, typename, typename, typename = A<_Tp>> class B { |
| 23 |
using _Impl = D; |
| 24 |
_Impl _M_impl; |
| 25 |
|
| 26 |
public: |
| 27 |
using key_compare = int; |
| 28 |
using iterator = C; |
| 29 |
template <typename _Alloc> B(key_compare p1, _Alloc p2) : _M_impl(p1, p2) {} |
| 30 |
template <typename _Alloc> B(_Alloc p1) : B(key_compare(), p1) {} |
| 31 |
iterator begin() { return {this, 0}; } |
| 32 |
void keys(); |
| 33 |
void values(); |
| 34 |
}; |
| 35 |
void fn1() { |
| 36 |
B<int, int, A<int>> m(fn1); |
| 37 |
m.begin(); |
| 38 |
} |