HP aC++/HP ANSI C A.06.28 Release (769149-001, March 2014)
S<char> s1; // Will trigger an error when the static_assert
// declaration is instantiated.
Extended friend types
Support is now included for extended friend declaration syntax which allows for non-class names
and non-elaborated class names to be declared as friend.
Example:
typedef struct S ST;
typedef int const IC;
class C {
friend S; // Okay in C++0x mode
friend ST; // Okay in C++0x mode
friend int; // Okay in C++0x mode (but no effect)
friend IC; // Okay in C++0x mode (but no effect)
friend int const; // Error: cv-qualifiers not (directly) allowed
};
Rvalue references
Rvalue references are supported. This feature is enabled implicitly in C++0x mode. The existence
of rvalue references allows the declaration of move constructors, which can be used to efficiently
copy class objects by transferring the resources from a source object that is soon to be defunct to
a destination object.
The syntax for declaring an rvalue-reference is: typename&& rRef (as opposed to the lvalue
syntax: typename& lRef). The move constructor simply takes an rvalue or lvaue reference and
returns an rvalue reference. This prevents invocation of the copy constructor; it therefore 'moves'
around references without the need for copying the objects.
Note that new mangling forms have been added for rvalue references; this matches the Itanium
ABI specification. The demangler c++filt has been updated to handle these new encodings.
Example:
int& ref = 10; //Error; references must bind to lvalues.
int&& const_ref = 20; //C++0x rvalue references bind to rvalues.
Objectless references to non-static data members
In the 2003 C++ Standard, the name of a non-static class data member could appear only in a
member function of that class or one derived from it, in a member access expression (x.m or p->m),
or to form a pointer to member (&X::m).
C++0x relaxes that restriction to allow such names as an unevaluated operand, such as
sizeof(X::m), typeid(X::m), and decltype(X::m). With this release, aC++ now accepts
this usage in C++0x mode and non-strict C++98/03 mode; such references are transformed into
a compiler-generated member-access expression using 0 cast to the appropriate type as the object
pointer.
As an extension, these references are also accepted as subexpressions of unevaluated operands,
such as sizeof(X::arr[0]), even in strict C++0x mode.
Defaulted and deleted functions
Deleted functions (= delete;) and defaulted special member functions (= default;) are now
supported.
A deleted function is a function declaration that cannot be referenced.
For example:
int f(int) = delete;
short f(short);
int x = f(3); // Error: selected function is deleted.
int y = f((short)3); // Okay.
New features in version A.06.25 27