[LLVMbugs] [Bug 12787] New: std::swap of std::pair fails to build in C++11 mode with libstdc++-4.7

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu May 10 12:03:13 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=12787

             Bug #: 12787
           Summary: std::swap of std::pair fails to build in C++11 mode
                    with libstdc++-4.7
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: peter at colberg.org
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


With the libstdc++-4.7 patch [1] for Clang C++11 support applied, the following
program fails to build with Clang 3.1-rc3.

cat t_libstdcxx11_swap.cpp

#include <utility>
int main()
{
    std::pair<int, int> p, q;
    std::swap(p, q);
}


clang++ -pedantic -Wall -std=c++11 -o t_libstdcxx11_swap t_libstdcxx11_swap.cpp

In file included from t_libstdcxx11_swap.cpp:1:
In file included from
/opt/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/utility:71:
/opt/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/stl_pair.h:193:37:
error:
      too many arguments to function call, expected 1, have 2
      noexcept(noexcept(swap(first, __p.first))
                        ~~~~        ^~~~~~~~~
/opt/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/stl_pair.h:253:23:
note:
      in instantiation of exception specification for 'swap' requested here
    noexcept(noexcept(__x.swap(__y)))
                      ^
t_libstdcxx11_swap.cpp:6:5: note: in instantiation of exception specification
for 'swap<int, int>' requested here
    std::swap(p, q);
    ^
/opt/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/stl_pair.h:191:7:
note:
      'swap' declared here
      void
      ^
1 error generated.


clang++ --version

clang version 3.1 (tags/RELEASE_31/rc3 156554)
Target: x86_64-unknown-linux-gnu
Thread model: posix


The same program compiles fine in C++98 mode.

clang++ -pedantic -Wall -std=c++98 -o t_libstdcxx11_swap t_libstdcxx11_swap.cpp


[1] http://clang.llvm.org/libstdc++4.7-clang11.patch

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list