HP Code Advisor Diagnostics

virtual int foo() = 1;
};
Action:
Provide the pure specifier only as "= 0", for example: virtual int foo() = 0;
Reference:
ANSI/ISO C++ 9.2, 10.4(2)
2321 data member initializer is not allowed
Cause:
Only static const members of integral or enumeration type can be initialized inline in a class
definition. For other types, provide the initialization outside the class definition.
Example:
int i = 100;
class Init {
static const int *p_i =
};
Action:
Initialize the member outside the class: int i = 100; class Init { static const int *p_i; }; const int*
Init::p_i =
Reference:
ANSI/ISO C++ 9.4.2 9.2(4)
2322 object of abstract class type %t is not allowed
Cause:
By definition, objects of abstract types cannot be created; any such attempt will be flagged as an
error by the compiler.
Example:
class Base {
virtual void foo() = 0;
};
Base b;
Action:
Either remove the statement that attempts to create an object of an abstract class type or make
the class concrete/ non-abstract by removing the pure virtual functions.
Reference:
ANSI/ISO C++ 10.4(3)
2323 function returning abstract class %t is not allowed
Cause:
An abstract class cannot be used as a function return type, parameter type or as the type of an
explicit conversion.
Example:
class Base {
virtual void foo() = 0;
};
class Derived : public Base {
44 Diagnostics Details