C++11 features

In addition to the existing C++11 features, new C++11 features are supported in this release of XL C/C++.

Note: IBM supports selected features of C++11, known as C++0x before its ratification. IBM will continue to develop and implement the features of this standard. The implementation of the language level is based on IBM's interpretation of the standard. Until IBM's implementation of all the C++11 features is complete, including the support of a new C++11 standard library, the implementation may change from release to release. IBM makes no attempt to maintain compatibility, in source, binary, or listings and other compiler interfaces, with earlier releases of IBM's implementation of the new C++11 features.
The following features are introduced in XL C/C++ V13.1:

The generalized constant expressions feature is enhanced in XL C/C++ V13.1.

You can use the -qlanglvl=extended0x option to enable most of the C++ features and all the currently supported C++11 features. For details, see -qlanglvl.

Defaulted and deleted functions

This feature introduces two new forms of function declarations to define explicitly defaulted functions and deleted functions. For the explicitly defaulted functions, the compiler generates the default implementations, which are more efficient than manually programmed implementations. The compiler disables the deleted functions to avoid calling unwanted functions.

You can use the -qlanglvl=defaultanddelete option to enable this feature.

For more information, see Explicitly defaulted functions (C++11) and Deleted functions (C++11).

Generalized constant expressions

The generalized constant expressions feature extends the set of expressions permitted within constant expressions. The implementation of this feature in XL C/C++ V12.1 was a partial implementation of what is defined in the C++11 standard. In this release, enhancements are made to support user-defined constexpr objects and constexpr pointers or references to constexpr functions and objects.

You can use the -qlanglvl=constexpr option to enable this feature.

For more information, see Generalized constant expressions (C++11).

The nullptr keyword

This feature introduces nullptr as a null pointer constant. The nullptr constant can be distinguished from integer 0 for overloaded functions. The constants of 0 and NULL are treated as of the integer type for overloaded functions, whereas nullptr can be implicitly converted to only the pointer type, pointer-to-member type, and bool type.

You can use the -qlanglvl=nullptr option to enable this feature.

For more information, see Null pointers.