Search code examples
c++assertc++17contract

Does VisualStudio 2017 already support C++17 code contracts?


does anyone know whether VS2017 already has support for code contracts as seen here C++17 code contracts?

When I try to use them using

explicit IniHandler(std::string fileName) [[expects: fileName != nullptr]]
{
    this->fileName = fileName;
}

It does not seem to work.

I am using the command line option /std:c++latest but still I get the warning "Identifier excpected".

Any help is gladly appreciated :)


Solution

  • Contracts are not part of C++17, and AFAIK there isn't even a TS (technical specification) available. The latest paper on contracts is P0542R0.

    Regardless, you can find all available C++17 features here as NathanOliver mentioned in the comments.