{"id":364095,"date":"2023-06-16T16:22:35","date_gmt":"2023-06-16T15:22:35","guid":{"rendered":"https:\/\/blog.jetbrains.com\/?post_type=rscpp&p=364095"},"modified":"2023-06-16T16:22:38","modified_gmt":"2023-06-16T15:22:38","slug":"resharper-cpp-2023-2-eap5","status":"publish","type":"rscpp","link":"https:\/\/blog.jetbrains.com\/rscpp\/2023\/06\/16\/resharper-cpp-2023-2-eap5\/","title":{"rendered":"ReSharper C++ 2023.2 EAP: Support for the C++23 Standard Library Modules"},"content":{"rendered":"
The new Early Access build is here with support for the C++23 standard library modules and C++20\u2019s You can download the EAP builds from our website or via the Toolbox App<\/a>.<\/p>\n <\/i>DOWNLOAD RESHARPER C++ EAP<\/a><\/p>\n The C++23 standard library introduces two named modules: In addition to shipping the source code for the <\/p>\n C++20 added <\/p>\n We\u2019ve also introduced support for the C++20\u2019s new <\/p>\n ReSharper C++ now highlights the We\u2019ve improved the evaluation engine to support aggregate initialization of This EAP build also brings a new compatibility inspection for forward declarations of C-style enums. Since the size of a C-style enum depends on its contents, the C++ standard forbids forward-declaring them without specifying the underlying type. MSVC, however, still accepts forward declarations like that, which can lead to non-portable code:<\/p>\n <\/p>\n In this EAP build, we\u2019ve improved the formatting for bit-field members. The options to align initializers and declaration names in columns now support bit-fields. We\u2019ve also added two new formatter settings specifically for bit-fields:<\/p>\n Among other noteworthy updates, the Safe Delete<\/em> refactoring now handles conflicts in dependent code. And for Unreal Engine 5.1 projects, we\u2019ve introduced support for the That\u2019s all for now! Please try out the new build and share your feedback with us. If you encounter any issues, don\u2019t hesitate to report them to our issue tracker<\/a>.<\/p>\n[[no_unique_address]]<\/code> attribute, new code formatter settings, and other updates. Read on for more details and check out the full list of issues<\/a> we\u2019ve fixed in this update.<\/p>\n
C++20 and C++23 updates<\/h2>\n
std<\/code> and
std.compat<\/code> (P2465<\/a>). You can now use
import std<\/code> or
import std.compat<\/code> to import the entire standard library instead of using a precompiled header or including specific headers for the parts of the standard library that you need. This way you\u2019ll also get all the usual benefits associated with the C++20 modules, including much faster compilation time and the absence of hidden dependencies on the standard library internals.<\/p>\n
std<\/code> and
std.compat<\/code> modules in the standard library, Visual Studio 17.6 introduced a new setting that enables the automatic building of these modules when using the
\/std:c++latest<\/code> switch (Project Properties | C\/C++ | Language | Build <\/em>IS<\/em>O C++23 Standard Library Modules<\/em>). As of this EAP build, ReSharper C++ will correctly resolve
import<\/code> directives for standard library modules and automatically build the necessary ones. This makes it much easier to experiment with modules and benefit from improved compilation time (depending on the size of your project, of course).<\/p>\n
char8_t<\/code>, a new fundamental, unsigned integral type that stores one UTF-8 code unit. The recently accepted paper P2513<\/a> allows the initialization of a
char<\/code> or
unsigned char<\/code> array with a UTF-8 string literal. Visual Studio has supported this proposal since the 17.4 release, and now ReSharper C++ supports it as well. Interestingly, this change has also been backported to C++20 as a defect report. Yes, the language standard can have bug-fix updates too!<\/p>\n
[[no_unique_address]]<\/code> attribute, which can be used instead of relying on the empty base class optimization.
[[no_unique_address]]<\/code> indicates that a unique address is not required for a non-static data member of a class (P0840<\/a>), allowing the compiler to lay out members of the class in a more efficient way. ReSharper C++ now takes
[[no_unique_address]]<\/code> into account when calculating the size of an object.<\/p>\n
Code analysis<\/h2>\n
#error<\/code> and
#warning<\/code> diagnostic preprocessor directives according to their severity level:
\n<\/p>\nconstexpr<\/code> arrays.
\n<\/p>\nCode formatting<\/h2>\n
\n
\nFinally, there is a new setting to turn off indentation in member initializer lists.<\/p>\nUE_INLINE_GENERATED_CPP_BY_NAME<\/code> macro, which lets you inline generated files into your module to improve compilation time.
UE_INLINE_GENERATED_CPP_BY_NAME<\/code> is now correctly handled when ordering
#include<\/code> directives, and it does not cause issues for the Rename<\/em> refactoring.<\/p>\n