| 1 |
// { dg-do run { target c++11 } } |
| 2 |
|
| 3 |
// Bug 90389 - std::deque::emplace tries to call wrong overload internally |
| 4 |
|
| 5 |
#include <deque> |
| 6 |
#include <testsuite_hooks.h> |
| 7 |
|
| 8 |
struct X |
| 9 |
{ |
| 10 |
X() = default; |
| 11 |
X(void*, void*, std::size_t) { } |
| 12 |
}; |
| 13 |
|
| 14 |
void |
| 15 |
test_pr90389() |
| 16 |
{ |
| 17 |
const int n = 3; |
| 18 |
std::deque<X> d(n); |
| 19 |
d.emplace(d.begin(), nullptr, nullptr, d.size()); |
| 20 |
VERIFY( d.size() == n+1 ); |
| 21 |
} |
| 22 |
|
| 23 |
struct Y |
| 24 |
{ |
| 25 |
Y() = default; |
| 26 |
Y(std::size_t, const Y&) { } |
| 27 |
}; |
| 28 |
|
| 29 |
void |
| 30 |
test_pr118079() |
| 31 |
{ |
| 32 |
const int n = 3; |
| 33 |
std::deque<Y> d(n); |
| 34 |
const Y y{}; |
| 35 |
d.emplace(d.begin(), d.size(), y); |
| 36 |
VERIFY( d.size() == n+1 ); |
| 37 |
} |
| 38 |
|
| 39 |
int main() |
| 40 |
{ |
| 41 |
test_pr90389(); |
| 42 |
test_pr118079(); |
| 43 |
} |