libstdc++: Prevent unwanted ADL in std::to_array [PR111512]
commit77cf3773021b0a20d89623e09d620747a05588ec
authorJonathan Wakely <jwakely@redhat.com>
Thu, 21 Sep 2023 08:14:57 +0000 (21 09:14 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Mon, 25 Sep 2023 08:48:44 +0000 (25 09:48 +0100)
treead38cad339b9a4898b95106bc5d6d666f1bb8cce
parent55cf4f843790faa3335ef3e4baf758860a9a107d
libstdc++: Prevent unwanted ADL in std::to_array [PR111512]

As noted in PR c++/111512, GCC does ADL for __builtin_memcpy if it is
unqualified, which can cause errors for template argument types which
cannot be completed.

Casting the memcpy arguments to void* prevents ADL from considering the
problem type.

libstdc++-v3/ChangeLog:

PR libstdc++/111511
PR c++/111512
* include/std/array (to_array): Cast memcpy arguments to void*.
* testsuite/23_containers/array/creation/111512.cc: New test.
libstdc++-v3/include/std/array
libstdc++-v3/testsuite/23_containers/array/creation/111512.cc [new file with mode: 0644]