https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113522

            Bug ID: 113522
           Summary: std::swap cannot be called with explicit template
                    argument std::array<int,3>
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

This program

#include <array>
#include <utility>

int main() {
    std::array<int,3> a, b;
    std::swap< std::array<int,3> >( a, b ); 
}

is accepted by MSVC and Clang with libc++, but GCC with libstdc++ complains:

error: no matching function for call to 'swap<std::array<int, 3>
>(std::array<int, 3>&, std::array<int, 3>&)'

Online demo: https://godbolt.org/z/8xnd5PsfE

Related discussion: https://stackoverflow.com/q/77844837/7325599

Reply via email to