cppcheck/addons/test/misc-test.cpp

27 lines
653 B
C++
Raw Normal View History

// To test:
// ~/cppcheck/cppcheck --dump misc-test.cpp && python ../misc.py -verify misc-test.cpp.dump
// Warn about string concatenation in array initializers..
2018-04-20 08:18:49 +02:00
const char *a[] = {"a" "b"}; // stringConcatInArrayInit
const char *b[] = {"a","b" "c"}; // stringConcatInArrayInit
// Function is implicitly virtual
class base {
virtual void dostuff(int);
};
class derived : base {
void dostuff(int); // implicitlyVirtual
};
// Pass struct to ellipsis function
struct {int x;int y;} s;
void ellipsis(int x, ...);
void foo(std::vector<std::string> v) {
ellipsis(321, s); // ellipsisStructArg
ellipsis(321, v[0]); // ellipsisStructArg
}