Qt-Generic-NoMixOfClassStructΒΆ

Consistently use either the keyword class or struct per composite type, do not mix them

Required inputs: IR

This rule will warn when some declarations or definitions of a composite type use the keyword class, while others for the same type use the keyword struct.
Bad code:
// foo.hpp
class Foo {
    // ...
};

// bar.hpp
struct Foo; // ERROR: Mixed use of class and struct keywords for the same type.
void bar(Foo *);
Good code:
// foo.hpp
class Foo {
    // ...
};

// bar.hpp
class Foo; // OK: Consistent use of class keyword for the same type.
void bar(Foo *);

Possible Messages

Key

Text

Severity

Disabled

mixed_class_struct_keywords

Mixed use of class and struct keyword for the same type.

None

False

Options