Main Content

C++17 Language Elements Supported in Polyspace

This table provides a partial list of C++ language elements that have been introduced since C++17 and its corresponding Polyspace® support. If your code contains nonsupported constructions, Polyspace reports a compilation error.

C++17 Std RefDescriptionSupported
C++2017-N3921std::string-view: Observe the content of an std::string object without owning the resourceYes
C++2017-N3922
  • When used in copy-list-initialization, auto deduces the type to be an std::initializer_list if the elements of the initializer list have an identical type. Otherwise, the auto deduction is ill-formed.

  • When using direct list-initialization with a braced initializer list containing a single element, auto deduces the type from that element.

  • When using direct list-initialization with a braced initializer list containing more than a single element, auto deduction of type is ill-formed.

Yes
C++2017-N3928The static_assert declaration no longer requires a second argument. Invoking static_assert with no message is now allowed: static_assert(N > 0);Yes
C++2017-N4051

C++ has templates that are not class templates, such as a template that takes templates as an argument. Previously, declaring such template-template parameters required the use of the class keyword. In C++17, you can use typename when declaring template-template parameters , such as:

template <template <typename> typename Tmpl> struct X;
Yes
C++2017-N4086Starting in C++17, trigraphs are no longer supported.No
C++2017-N4230

Starting in C++17, use a qualified name in a namespace definition to define several nested namespaces at once. For instance, these code snippets are equivalent:

  • namespace base::derived{
    //..
    }
  • namespace {
        namespace derived{
            //...
        }
    }

Yes
C++2017-N4259The function std::uncaught_exceptions is introduced in C++17, which returns the number of exceptions in your code that are not handled. The function std:uncaught_exception, which returns a Boolean value, is deprecated.Yes
C++2017-N4266Starting in C++17, namespaces and enumerators can be annotated with attributes to allows clearer communication of developer intention.Yes
C++2017-N4267Starting in C++17, the prefix u8 is supported. This prefix creates a UTF-8 character literal. The value of the UTF-8 character literal is equal to its ISO 10646 code point value if the code point value is in the C0 Controls and Basic Latin Unicode block. Yes
C++2017-N4268Allow constant evaluation of nontype template arguments.Yes
C++2017-N4295Allow fold expressions Yes
C++2017-N4508Allow untimed std::shared_mutex The use of std::shared_mutex does not cause a compilation error. Polyspace does not support sharing mutex objects by using std::shared_mutex.
C++2017-P0001R1 Remove the use of the register keyword Yes
C++2017-P0002R1Remove operator++(bool) Yes
C++2017-P0003R5 Remove deprecated exception specifications by using throw(<>) Bug Finder removes the exception specification specified by using throw() statements. Code Prover raises a compilation error when throw() statements are present in C++17 code.
C++2017-P0012R1Make exception specifications part of the type system Yes
C++2017-P0017R1 Aggregate initialization of classes with base classes Yes
C++2017-P0018R3 Allow capturing the pointer *this in Lambda expressionsYes
C++2017-P0024R2Standardization of the C++ technical specification for Extension for ParallelismPolyspace supports this feature when you use the Visual 15.x and Intel C++ 18.0 compilers.
C++2017-P002842Using attribute namespaces without repetitionYes
C++2017-P0035R4Dynamic memory allocation for over-aligned dataYes
C++2017-P0036R0Unary fold expressions and empty parameter packsYes
C++2017-P0061R1 Use of __has_include in preprocessor conditionals Yes
C++2017-P0067R5 Elementary string conversions No
C++2017-P0083R3Splicing maps and setsPolyspace supports this feature when the compiler you use also supports this feature. For instance, Polyspace supports this feature when you use g++ as compiler.
C++2017-P0088R3std::variantPartially supported.
C++2017-P0091R3 Template argument deduction for class templates Partially supported.
C++2017-P0127R2Non-type template parameters that have auto typeYes
C++2017-P0135R1Guaranteed copy elision Partially supported.
C++2017-P0136R1 New specification for inheriting constructorsNo
C++2017-P0137R1 Replacement of class objects containing reference members Yes
C++2017-P0138R2 Direct-list-initialization of enumerations Yes
C++2017-P0145R3 Stricter expression evaluation order No new syntax/keyword is introduced and therefore does not affect Polyspace support for C++17.
C++2017-P0154R1 Hardware interference size Supported with Visual Studio Compiler
C++2017-P0170R1 constexpr Lambda expressions Partially supported
C++2017-P018R0Differing begin and end types in range-based for loopsYes
C++2017-P0188R1[[fallthrough]] attributeYes
C++2017-P0189R1 [[nodiscard]] attribute Yes
C++2017-P0195R2 Pack expansions in using-declarations Yes
C++2017-P0212R1 [[maybe_unused]] attribute Yes
C++2017-P0217R3 Structured Bindings Polyspace does not support binding by using an rvalue.
C++2017-P0218R1 std::filesystem No
C++2017-P0220R1std::anyYes
C++2017-P0220R1std::optionalBug Finder supports the syntax. The semantics are partially supported. Code Prover does not support this feature.
C++2017-P0226R1Mathematical special functionsNo
C++2017-P0245R1 Hexadecimal floating-point literals Yes
C++2017-P0283R2 Ignore unknown attributes Yes
C++2017-P0292R2 constexpr if statements Yes
C++2017-P0298R3 std::byte Yes
C++2017-P0305R1 init-statements for if and switch Yes
C++2017-P0386R2 Inline variables No
C++2017-P0522R0 Invoke partial ordering to determine when a template template-argument is a valid match for a template-parameterPartially supported

See Also

Related Topics