https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111512
Bug ID: 111512 Summary: GCC's __builtin_memcpy can trigger ADL Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: de34 at live dot cn Target Milestone: --- When using libstdc++ in GCC 14, the following program compiles with Clang but is rejected by GCC (https://godbolt.org/z/WKbe1c3v7). ``` #include <array> #include <utility> struct incomplete; template<class T> struct holder { T t; }; using validator = holder<incomplete>*; int main() { validator a[1]{}; (void) std::to_array(a); (void) std::to_array(std::move(a)); } ``` The implementation can be made to work for GCC if `::` is added before the call to __builtin_memcpy (https://godbolt.org/z/6Mx11T3f9). So the reason for failure seems to be that GCC's __builtin_memcpy can trigger ADL like a real function.