What’s New in ReSharper C++ 2023.2

ReSharper C++ 2023.2 introduces the Safe Delete refactoring to let you remove symbols from the source code safely. For modern C++ projects, several new C++20 and C++23 features are now supported, including C++23 standard library modules. This version also comes with the ReSharper AI Assistant, specifically designed to help you with programming tasks.

Download

Free 30-day trial available

AI Assistant Limited access

AI Assistant is not bundled with ReSharper and must be installed separately. For the time being, there’s a waiting list for access to the AI Assistant feature.

Learn more about AI Assistant and how to install it via the Toolbox App or dotUltimate installer in our webhelp.

ReSharper C++ 2023.2 brings in the ReSharper AI Assistant – an AI-driven chat specifically designed to answer programming questions and help you with troubleshooting, refactoring, documenting, and other development workflows.

ReSharper’s AI Assistant takes into consideration the language and technologies used in your project. This context awareness tailors its responses right out of the gate, saving you time and effort.

Feel free to include parts of the source code in your queries. ReSharper will detect the code you sent or pasted into the chat and properly format it, while the AI model will explain the logic behind the code and help you refactor, find issues, or document it.

C++23 support

The if consteval statement is a new constant evaluation feature in C++23 that further develops the idea of C++20 consteval and std::is_constant_evaluated(). If the evaluation of the if consteval statement occurs during a constant evaluation, then the following compound statement is executed. Otherwise, the else branch is executed.

ReSharper C++ introduces support for if consteval and brings a set of related inspections:

  • consteval if is always constant.
  • std::is_constant_evaluated always evaluates to a constant.
  • if can be replaced by if consteval.

ReSharper C++ now supports the named modules std and std.compat introduced in the C++23 standard library. If you use Visual Studio 17.6 or later, you can now use import std or import std.compat to import the entire standard library instead of using a precompiled header or including specific standard library headers.

Before C++23, all operators had to be non-static member functions. Call operators, however, are often used with member-less function objects, and allowing operators to be static in this case can lead to more efficient code. C++23 allows both operator() and operator[] to be static.

C++20 support

We’ve been working hard on polishing the C++20 modules support, fixing various corner issues in real-world projects that use modules. When processing modules internally, ReSharper C++ now implements the discarding of declarations that are not decl-reachable, significantly improving performance on modules that include a lot of headers into the global module fragment.

In addition, we’ve implemented several changes to better support modules in CMake projects. ReSharper C++ now recognizes .cppm files as module interfaces and includes experimental support for modules located outside of the project folder.

C++20’s new [[no_unique_address]] attribute indicates that a unique address is not required for a non-static data member of a class, allowing the compiler to lay out members of the class in a more efficient way. ReSharper C++ now takes [[no_unique_address]] into account when calculating the size of an object.

ReSharper C++ 2023.2 also implements the recently accepted C++20 defect report that allows the initialization of a char or unsigned char array with a UTF-8 string literal.

Safe Delete refactoring

ReSharper C++ introduces the Safe Delete refactoring to let you safely remove symbols from your source code. This refactoring is available for classes, functions, variables, enumerators, namespaces, and even concepts.

To invoke the refactoring, place the caret on the symbol you want to delete and press Alt+Del, or select Safe Delete from the Refactor This menu.

Before deleting a symbol, ReSharper C++ searches for its usages and lets you preview the changes to the source code, so you can be sure that all the removals are intended. If you try to delete a complex entity like a class or a namespace, ReSharper C++ will recursively check the usages for all its members.

Unreal Engine

This release brings performance improvements for indexing Blueprints. The first time you open a project, ReSharper C++ indexes all of your Blueprint assets to power features like Find Usages and show the values of serialized data directly in the text editor.

Previously, ReSharper C++ would index these assets at the same priority as your C++ code, meaning that it took longer before the project was ready for work. ReSharper C++ 2023.2 will index assets in the background after indexing your C++ code without interfering with your work.

We’ve improved smart completion for wrapper types with standard assignment semantics. For example, when assigning to a variable of the TEnumAsByte type, completion will suggest enumerators from the underlying enumeration type.

For Unreal Engine 5.1 projects, we’ve introduced support for the UE_INLINE_GENERATED_CPP_BY_NAME macro, which lets you inline generated files into your module to improve compilation time.

Coding assistance

With improved completion for dependent code, you will now get completion items when the type is restricted by a concept or a trait. ReSharper C++ now considers the standard std::is_same/std::is_base_of type traits, their _v value-aliases, the corresponding std::same_as/std::derived_from concepts, and the Unreal Engine TIsSame trait.

For more helpful code completion suggestions, ReSharper C++ now also extracts type and value requirements from requires-clauses, if constexpr, and SFINAE.

There are two new complementary context actions to help you move a template parameter constraint to the requires-clause and convert a requires-clause to a template parameter constraint.

If you have a recursive call, ReSharper C++ will mark it in the gutter, making it more visible.

The code completion list now filters out reserved identifiers and suggests them only after _. This means you no longer have to scroll through the suggestions from standard libraries unless you need them.

ReSharper C++ 2023.1 introduced proper highlighting and formatting for macro substitution in the Quick Documentation popup and tooltips on hover. In the 2023.2 release, these improvements will also work for macro definitions and Parameter Info in code completion.

We’ve improved the evaluation engine to support aggregate initialization of constexpr arrays.

We've improved compatibility with GCC and Clang compilers and libc++/libstdc++ standard libraries. This includes support for more builtins like __integer_pack, __is_convertible/__is_nothrow_convertible, and updates for the previously supported ones.

When you specify the parameter direction with the [in], [in,out], or [out] attribute of the Doxygen param command, the tooltips now fetch them from your comment.

Code analysis

ReSharper C++ 2023.2 adds a new inspection that detects redundant dereferencing and address-of operators. It offers you several quick-fixes to simplify member access and remove redundant operators.

Another new inspection highlights redundant template arguments that match the corresponding default template argument and can be omitted.

A new compatibility inspection warns you about forward declarations of C-style enums without an underlying type, which are forbidden by the C++ standard but accepted by MSVC, possibly causing non-portable code.

ReSharper C++ now highlights the #error and #warning diagnostic preprocessor directives according to their severity level.

We’ve also updated the bundled clang-tidy binary to Clang 16, providing new checks and fixes.

MSVC can use either the traditional or the new standard-conforming preprocessor depending on the value of the /Zc:preprocessor compiler argument. ReSharper C++ now reads the value of this argument from the project properties and adjusts the behavior of the built-in preprocessor accordingly.

Navigation

ReSharper C++ 2023.2 brings several improvements to Go to declaration for more consistent and straightforward code navigation without extra steps:

  • When invoked on a class name in a constructor call, Go to declaration now navigates to the constructor instead of the containing class.
  • Go to declaration now navigates to the first typedef or type alias declaration instead of showing the menu with all declarations.
  • Go to declaration on a module name jumps between interface and implementation units for the same module.
  • Go to declaration on a folder in an #include path opens the folder.

Additionally, Type of symbol is now available on non-declarator symbols. The way it works there is similar to Go to declaration.

Formatting and typing assist

When generating documentation comments, ReSharper C++ will now adjust the documentation template according to the comment style from the editor. For /**, typing assistance will generate the comment in the /** */ style, and for ///, the comment will be in the /// style.

This release brings several improvements to the formatting of bit-field members. The options to align initializers and declaration names in columns now support bit-fields. There are also two new formatting settings for spaces before and after the colon in bit-field declarations and for alignment of bit-field sizes in columns.

A new typing assist option lets you turn off the generation of documentation comments to avoid conflicts with Visual Studio's built-in generator (ReSharper | Options | Environment | Editor | Behavior | C++, C, HLSL | Generate documentation comments).

We've also updated the bundled clang-format binary and fixed the clang-format engine to prevent it from removing the newline at the end of a file.

Take a look at What's New in ReSharper to learn about the other changes introduced in this release. For example, ReSharper introduces the predictive debugger, which foresees all possible states triggered by executing a program without having to actually execute it.

Download

Free 30-day trial available