User:Dydzio/cpp standard upgrade

From VCMI Project Wiki
Jump to: navigation, search

As of 22.06.2019 - linux debian will receive next stable version in few weeks and its GCC will upgrade from 6.3 to 8.3. Ubuntu 18.04 supports GCC 7.4, [AVS] currently uses GCC 7.3.

Scripting branch breaks VS 2015 compatibility by (bug/lack of C++ feature/whatever) in ERM parser. VS 2017 (MSVC 19.1x) has way better C++ standard support and there is almost no reason to still use 2015.

If we assume GCC 7.3 (GCC 7) as minimal supported GCC version then on GCC part we can use:

- full C++14 (also in GCC 6 if we do not want GCC 7 for some reason)

- almost full C++17, with exception of few features listed below, with optional examples of related standard library elements in braces:

  • Polymorphic memory resources (<memory_resource>)
  • C++17 should refer to C11 instead of C99
  • Elementary string conversions (std::to_chars, std::from_chars, chars_format)
  • Standardization of Parallelism TS
  • File system library (std::filesystem)
  • Template argument deduction for class templates - only partial support, probably conforms to v1 / draft paper?
  • std::char_traits<char> and std::char_traits<wchar_t> in constant expressions.

There is no guarantee this is everything, travis CI should help. If somebody uses "not fully supported" feature on purpose he should let others know in PR description / slack etc.

Some sources:


If we decide to use Visual Studio 2017 as minimum supported VS version then we can use:

- full C++14

- vast majority of C++17 (microsoft claims "full comformance but with bugs" in VS 2017)

Apart from cppreference page... full conformance overview for VS 2015/2017/2019 is available on https://docs.microsoft.com/en-us/cpp/overview/visual-cpp-language-conformance?view=vs-2019

Especially watch out for following stuff in Visual Studio 2017:

  • Preprocessor misbehavior, especially using variadic macros - last C++11 conformance bug, fixed in VS 2019
  • Some bugs in advanced lambda usage, also fixed in VS 2019 - not directly C++17 related
  • std::is_constant_evaluated() not working - C++17 related

Other not working stuff in VS2017 (C++17 related):