Open llvmbot opened 12 years ago
Re-opening because I'm not totally against it, but someone will have to go implement it and assess whether it's actually a useful warning.
I'm on the fence about this one. I can't see any reason to use -> on an array, yet it also seems unlikely that a user would actually make this mistake and still get the program to type-check. We'd just have to implement it and run it across a pile of code to see how many bugs vs. false positives it finds.
This is a coding standards sort of thing, not likely to be indicative of a bug.
I would think that this is similar to choosing to throw a warning on assignment inside a conditional. It is valid c++ but unlikely to be intentional and almost always a bug.
Is there a specific pattern/example where acting on a fixed-size array using -> is desired?
This is a coding standards sort of thing, not likely to be indicative of a bug.
Extended Description
Version: Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn) Target: x86_64-apple-darwin11.3.0 Thread model: posix
compiled with -Weverything
The following should generate a warning:
struct s { void f(); }
int main(int argc, char* argv[]) { s vals[4]; vals->f();
return 0; }
it is unlikely that a user wants to access the first element of an array by using vals->f(); rather than vals[0].f();