Extensions for C++11 compatibility

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 part of a continual phased release process leading towards full compliance with C++11. They can be enabled by using the -qlanglvl=extended0x group option. You can also use specific compiler options to enable or disable these features. See the following table.

Table 1. IBM XL C++ language extensions for compatibility with C++11
Language feature Discussed in: C++11 individual suboption control
Auto type deduction The auto type specifier (C++11)

-qlanglvl=[no]autotypededuction

C99 long long Types of integer literals in C99 and C++11

-qlanglvl=[no]c99longlong

IBM extension
-qlanglvl=[no]extendedintegersafe

C99 preprocessor features adopted in C++11 C99 preprocessor features adopted in C++11 (C++11)

-qlanglvl=[no]c99preprocessor

Decltype The decltype(expression) type specifier (C++11)

-qlanglvl=[no]decltype

Defaulted and deleted functions

Explicitly defaulted functions (C++11)

Deleted functions (C++11)

-qlanglvl=[no]defaultanddelete

Delegating constructors Delegating constructors (C++11)

-qlanglvl=[no]delegatingctors

Explicit conversion operators Explicit conversion operators (C++11)

-qlanglvl=[no]explicitconversionoperators

Explicit instantiation declarations Explicit instantiation declaration

-qlanglvl=[no]externtemplate

Extended friend declarations Friends (C++ only)

-qlanglvl=[no]extendedfriend

Generalized constant expression Generalized constant expressions (C++11)

-qlanglvl=[no]constexpr

Inline namespace definitions Inline namespace definitions (C++11)

-qlanglvl=[no]inlinenamespace

Nullptr Null pointers

-qlanglvl=[no]nullptr

Reference collapsing Reference collapsing (C++11)

-qlanglvl=[no]referencecollapsing

Right angle brackets Class templates (C++ only)

-qlanglvl=[no]rightanglebracket

Rvalue references

Using rvalue references (C++11)

-qlanglvl=[no]rvaluereferences

Scoped enumerations Enumerations

-qlanglvl=[no]scopedenum

static_assert static_assert declaration (C++11)

-qlanglvl=[no]static_assert

Trailing return type Trailing return type (C++11)

-qlanglvl=[no]autotypededuction

Variadic templates Variadic templates (C++11)

-qlanglvl=[no]variadic[templates]

Notes:
  • You can also use the -qlanglvl=extended group option to enable the explicit instantiation declarations feature.
  • If you try to use a C++11 feature when the feature is not enabled, the compiler issues an information message that follows a syntax error message. The information message indicates how to turn on the C++11 feature to recover from the syntax error. The involved C++11 features are listed as follows:
    • C99 preprocessor features adopted in C++11
      • Mixed string literal concatenation
      • The __STDC_HOSTED__ macro
    • Defaulted and deleted functions
    • Delegating constructors
    • Explicit conversion operators
    • Generalized constant expressions
    • Inline namespace definitions
    • nullptr
    • Reference collapsing
    • Right angle brackets
    • Rvalue references
    • Scoped enumerations
    • Variadic templates