Page MenuHomePhabricator

Fix for Bug 28423 - error: too many arguments to function call, expected single argument '__pq', have 2 arguments void swap(priority_queue __pq)
ClosedPublic

Authored by CrisCristescu on Jul 26 2016, 5:36 AM.

Details

Summary

This patch is a fix for the Bug 28423.

The problem was that the context std context to which compared against was not the primary context.

Diff Detail

Repository
rL LLVM

Event Timeline

CrisCristescu retitled this revision from to Fix for Bug 28423 - error: too many arguments to function call, expected single argument '__pq', have 2 arguments void swap(priority_queue __pq) .
CrisCristescu updated this object.
CrisCristescu set the repository for this revision to rL LLVM.
rsmith added inline comments.Aug 9 2016, 2:11 PM
lib/Sema/SemaExceptionSpec.cpp
47

Just change this to

`!RD || !getStdNamespace() || !RD->getEnclosingNamespaceContext().Equals(getStdNamespace())`

Updated the fix as suggested.

rsmith accepted this revision.Aug 10 2016, 1:46 PM
rsmith edited edge metadata.

Code change looks OK, but can you reduce the testcase some more? Something like

namespace std {
  template<typename T> void swap(T, T);
  template<typename T> struct array {
    T t;
    void swap(array) noexcept(noexcept(swap(t, t)));
  };
}

... as a header and ...

void f(std::array<int> ai) { ai.swap(ai); }

... as a test seems like they should be enough, once you create the situation that Sema's StdNamespace is not the primary context for the std namespace.

This revision is now accepted and ready to land.Aug 10 2016, 1:46 PM
v.g.vassilev closed this revision.Aug 20 2016, 7:58 AM
v.g.vassilev edited edge metadata.

Landed in r279371.