| 1 |
// { dg-do compile { target c++20 } } |
| 2 |
|
| 3 |
// Bug libstdc++/111511 - Incorrect ADL in std::to_array in GCC 11/12/13 |
| 4 |
// Bug c++/111512 - GCC's __builtin_memcpy can trigger ADL |
| 5 |
|
| 6 |
#include <array> |
| 7 |
#include <utility> |
| 8 |
|
| 9 |
struct incomplete; |
| 10 |
|
| 11 |
template<class T> |
| 12 |
struct holder { |
| 13 |
T t; // { dg-bogus "'holder<T>::t' has incomplete type" } |
| 14 |
}; |
| 15 |
|
| 16 |
// A complete type that cannot be used as an associated type for ADL. |
| 17 |
using adl_bomb = holder<incomplete>*; |
| 18 |
|
| 19 |
int main() |
| 20 |
{ |
| 21 |
adl_bomb a[1]{}; |
| 22 |
(void) std::to_array(a); |
| 23 |
(void) std::to_array(std::move(a)); |
| 24 |
} |