Skip to main content

IAR Embedded Workbench for RH850 3.20.x

Overview—Standard C++

In this section:

The IAR C++ implementation fully complies with the ISO/IEC 14882:2014 C++ (“C++14”) or 14882:2017 C++ (“C++17”) standard, except for source code that depends on thread-related system headers, or the filesystem header. In IAR user documentation, the ISO/IEC 14882:2017 C++ standard is referred to as Standard C++.

Atomic operations are available for cores where the instruction set supports them. See Atomic operations.

The IAR C/C++ compiler accepts source code written in the C++17 standard or a superset thereof.

  • When using the DLIB C++14 library, those features of C++17 that require library support are not available.

  • When using the Libc++ C++17 library, all features of C++17 are available, unless otherwise noted. In addition, some features of C++20 are also available, see Supported C++20 features.

For an overview of the differences between the various versions of the C++ standard, see the Wikipedia articles C++20, C++17, C++14, C++11, or C++ (for information about C++98).

Note

There is also a set of C++ Standard Template Library (STL) headers from an older version of the DLIB library (DLIB5). They have fewer features, but can in some cases result in significantly smaller code for map/set and vector. See the documentation in the file rh850/doc/HelpDLIB5.html.

Supported C++20 features

The IAR C/C++ compiler accepts source code written in the C++17 standard or a superset thereof. However, when using the Libc++ library, some features of C++20 are also available, and support for more C++20 features is continuously added.

At the time of writing, the following C++20 features are supported when using the Libc++ library:

  • Concepts (including abbreviated function template declarations)

  • Three-way comparison (also known as the spaceship operator) <=>

  • constinit and consteval

  • constexpr relaxations. The following is allowed in constant expressions:

    • virtual functions

    • try-catch blocks

    • dynamic_cast and polymorphic typeid

    • changing the active member of a union

    • transient allocation

    • trivial default initialization

    • unevaluated asm-declarations

  • Lambdas

    • Default constructible and assignable stateless lambdas

    • Lambdas in unevaluated contexts

    • Template syntax for generic lambdas

  • explicit (bool)

  • Relaxed typename: using typename is optional in more contexts

  • Library support for std::is_constant_evaluated, std::bit_cast, std::identity, std::type_identity, std::common_reference , and std::remove_cvref

Note that __cplusplus is still defined to 201703L (but individual feature testing macros are updated according to their respective supported level. For example, __cpp_constexpr is defined to 202002L).

There are some limitations in the current C++20 support:

  • std::strong_ordering with long double is not supported.

  • Issues related to concepts: CA104 of P2103R0 (Clarify declaration matching and partial ordering requiring substitution into constraints) and P2113R0 (Partial ordering of rewritten operator candidates resulting from constrained templates).

  • Issues related to constexpr: CWG 1581 (When are constexpr member functions defined?).

Exceptions and RTTI

Exceptions and RTTI are not supported. Thus, the following are not allowed:

  • throw expressions

  • try-catch statements

  • Exception specifications on function definitions

  • The typeid operator

  • The dynamic_cast operator