Early Access Program

ReSharper C++ Starts the 2023.2 Early Access Program

The ReSharper C++ 2023.2 Early Access Program starts today!

Give the free EAP builds a try and let us know what you think about the changes and improvements they introduce.

ReSharper C++ 2023.2 EAP

You can download the EAP builds from our website or via the Toolbox App.

DOWNLOAD RESHARPER C++ EAP

Safe Delete refactoring

ReSharper C++ introduces the Safe Delete refactoring to let you remove symbols from the source code safely. Starting with this EAP build, the refactoring is available for deleting a class, function, variable, namespace, and even a concept.

“What makes this refactoring safe?” you might ask. The trick is that before deleting a symbol, ReSharper C++ searches for usages and lets you preview the results, so you can be sure that all the removals are intended. For example, if you try to delete a complex entity, like a class or namespace, ReSharper C++ will recursively check the usages for all its members.

To invoke the refactoring, place the caret on the item you want to delete and select Safe Delete from the Refactor This menu. Alternatively, choose ReSharper | Refactor | Safe Delete from the main menu, or use the corresponding shortcut (Alt+Del or Ctrl+R,D, depending on the shortcut scheme you use).

Safe Delete

If you want to keep some code slated for removal, double-click on the usage in the list to navigate to the corresponding line and make the necessary adjustments. Once you’re happy with the list of usages to be removed, click Next to confirm your code deletion.

Safe Delete conflicts

C++23’s if consteval

C++20 brought several new features related to constant evaluation, including consteval (P1073) and std::is_constant_evaluated() (P0595). As a quick recap, the consteval keyword specifies a function that can be evaluated only during compile-time, while std::is_constant_evaluated() is a library function that checks whether the current evaluation is a constant evaluation.

C++23 fixed some interaction issues for these features and further developed the idea by introducing the if consteval statement (P1938). If the evaluation of this statement occurs during a constant evaluation, then the following compound statement is executed. Otherwise, the else branch is executed.

In this EAP build, ReSharper C++ introduces support for if consteval and brings new inspections to help you play around with recent language additions for constant evaluation:

  • consteval if is always constant” warns you when the condition is always true in the immediate context.
  • std::is_constant_evaluated will always evaluate to constant” warns you when the function result is always true in a manifestly constant-evaluated expression.
  • if can be replaced by if consteval” suggests a quick-fix to update your code in C++23 style.

if can be replaced by if consteval

Updates for C++20’s concepts support

With improved completion for dependent code, you will now get completion items when the type is restricted by concepts or traits. ReSharper C++ now considers the full variety of 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.
Completion for concepts

For more helpful code completion suggestions, ReSharper C++ now also extracts type and value requirements from a requires-clause, if constexpr, and SFINAE, like template <class T, class = std::enable_if_t<std::is_base_of<X, T>>> void foo(T arg);.

A new context action will help you move the template parameter constraint to a requires-clause:
Move constraint to requires-clause

There’s also a complementary context action to help you with the opposite update – converting a requires-clause to a template parameter constraint:
Convert clause to parameter constraint

Finally, all the usual ReSharper C++ inspections for unused entities now also work for templates and concepts.

Other improvements

ReSharper C++ 2023.1 introduced proper highlighting and formatting for macro substitution in the Quick Documentation popup and tooltips on hover. For consistency, starting with this EAP build, these improvements will also work for macro definitions themselves:
Macro definition tooltip

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:
Doxygen parameter direction

This EAP build adds a new inspection that detects redundant dereferencing and taking addresses. It offers you several quick-fixes to remove the redundancies:

  • “Operator . can be replaced with ->” and vice versa.
    Operator . can be replaced
  • “Taking address of dereferencing can be removed” and vice versa.
    Taking address of dereferencing can be removed

ReSharper C++ now supports the /Zc:preprocessor compiler option, which enables preprocessor conformance mode.

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

Those are the biggest highlights for this first EAP build. If you have any feature requests or encounter any issues, please submit them to our tracker. We are looking forward to your feedback!

DOWNLOAD RESHARPER C++ EAP

Your ReSharper C++ team
JetBrains
The Drive to Develop

image description