google / styleguide

Style guides for Google-originated open-source projects
https://google.github.io/styleguide/
Apache License 2.0
37.44k stars 13.3k forks source link

False positive: Add #include <algorithm> for sort #174

Open rakhimov opened 8 years ago

rakhimov commented 8 years ago

Please see https://github.com/theandrewdavis/cpplint/issues/27

mortenfyhn commented 5 years ago

I have another very similar false positive:

Using a minimal example file test.h with contents

// Copyright 2019 Morten Fyhn Amundsen

#ifndef TEST_H_
#define TEST_H_

void copy(int) {}

#endif  // TEST_H_

I also get a false positive suggesting to include the algorithm header:

$ cpplint/cpplint.py test.h
test.h:6:  Add #include <algorithm> for copy  [build/include_what_you_use] [4]
Done processing test.h
Total errors found: 1

I'm on the current version of the gh-pages branch (9c6b371).


More information:

void copy() {}

gives no errors (no missing algorithm header message). However,

void copy(void) {}

causes cpplint to report the missing algorithm header error.