HP aC++/HP ANSI C A.06.27 Release Notes

explicit operator bool(){return true;}
};
int main(int argc, char** argv)
{
A a;
(void)bool(a); // Okay
if (a) {} // Okay
//bool b = a; // Would be an error
return 0;
}
Trailing return types (with "auto")
In the C++11 mode the compiler now accepts "trailing return types" in function declarators following
an "auto" type specifier.
auto f()->int {return 0;} // Same as int f(){...}
int main(int argc, char** argv)
{
return f();
}
Standard attributes
In C++11 mode, the attributes "align", "carries_dependency", "final", and "noreturn" are now
supported.
[[noreturn]] void f() {} // Warning is issued: calls to f() do return.
int main(int argc, char** argv)
{
f();
return 0;
}
Attributes for checking, hiding and overriding
In the C++11 mode, the compiler now supports the standard attributes "override", "hiding", and
"base_check". Attribute "override" indicates that a virtual function overrides a matching function
in a base class. "hiding" indicates that a derived-class member hides a base class member.
"base_check" can appear on a class definition, and causes the compiler to issue errors if overriding
virtual functions are not marked with [[override]] or hiding members are not marked with [[hiding]].
struct B { virtual void f(), f(int); };
struct[[base_check]] D: B {
[[override]] virtual void f(); // Okay.
[[override]] virtual void f(char); // Error: No overridden f(char) in B.
virtual void f(int); // Error: Missing [[override]].
};
int main(int argc, char** argv)
{
return 0;
}
Use of "this" in trailing-return-types
The compiler now allows references to "this" in decltype expressions in late-specified return types
in member functions in the C++11 mode.
struct A {
int i;
auto f() const -> decltype(this->i) { return 0; } // Okay now.
};
int main(int argc, char** argv)
{
return 0;
}
Improved support for C++11 core language features 9