| 1 |
// { dg-do compile { target c++17 } } |
| 2 |
// { dg-additional-options "-Wno-analyzer-too-complex" } */ |
| 3 |
|
| 4 |
template <typename> struct iterator_traits; |
| 5 |
template <typename _Tp> struct iterator_traits<_Tp *> { |
| 6 |
typedef _Tp &reference; |
| 7 |
}; |
| 8 |
template <typename _Iterator> struct __normal_iterator { |
| 9 |
_Iterator _M_current; |
| 10 |
__normal_iterator(_Iterator &__i) : _M_current(__i) {} |
| 11 |
typename iterator_traits<_Iterator>::reference operator*() { |
| 12 |
return *_M_current; |
| 13 |
} |
| 14 |
}; |
| 15 |
template <typename> struct allocator; |
| 16 |
template <typename> struct allocator_traits; |
| 17 |
template <typename _Tp> struct allocator_traits<allocator<_Tp>> { |
| 18 |
using pointer = _Tp *; |
| 19 |
}; |
| 20 |
struct TPkcs11Token; |
| 21 |
struct __alloc_traits : allocator_traits<allocator<TPkcs11Token>> {}; |
| 22 |
struct _Vector_base { |
| 23 |
typedef __alloc_traits::pointer pointer; |
| 24 |
struct { |
| 25 |
pointer _M_start; |
| 26 |
} _M_impl; |
| 27 |
}; |
| 28 |
struct : _Vector_base { |
| 29 |
__normal_iterator<pointer> begin() { return _M_impl._M_start; } |
| 30 |
} list_tokens_token_list; |
| 31 |
struct TPkcs11Token { |
| 32 |
int *add_info; |
| 33 |
}; |
| 34 |
void list_tokens() { |
| 35 |
for (__normal_iterator base = list_tokens_token_list.begin();;) { |
| 36 |
int *add_info = new int; |
| 37 |
(*base).add_info = add_info; // { dg-warning "leak" } |
| 38 |
} |
| 39 |
} |