New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 770572 link

Starred by 1 user

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug


Previous locations:
webrtc:8304


Sign in to add a comment

cpplint complains that declaration of swap function needs #include <utility>

Reported by kwiberg@webrtc.org, Sep 28 2017

Issue description

I'm adding a class that declares a swap function in its .h file:

  class PayloadUnion {
   public:
    ...
    friend void swap(PayloadUnion& a, PayloadUnion& b);

and defines it in its .cc file:

  void swap(PayloadUnion& a, PayloadUnion& b) {
    using std::swap;
    swap(a.Audio, b.Audio);
    swap(a.Video, b.Video);
    swap(a.is_audio_, b.is_audio_);
  }

Presubmit (specifically, cpplint.py) correctly complained that the .cc file needs to #include <utility> since it uses std::swap.

However, it also complains that the .h file needs to #include <utility>. AFAICT this is wrong, since the .h file makes no reference to std::swap.

(CL where the problem appeared: https://webrtc-review.googlesource.com/c/src/+/4340)
 
Project: chromium
Moved issue webrtc:8304 to now be issue chromium:770572.
Cc: avakulenko@chromium.org
Components:
Labels: Build-Tools
avakulenko: do you know why we see this?
Components: Build

Sign in to add a comment