Rscpp logo

The ReSharper C++ Blog

The Visual Studio Extension for C++ Development

News

ReSharper C++ 2021.1 Early Access Program Is Now Open

We have a lot of interesting things planned for ReSharper C++ 2021.1, and in this post we’ll outline our first steps. The ReSharper C++ 2021.1 Early Access Program starts today!

ReSharper C++ 2021.1 EAP

Here are the main highlights of the first EAP build:

  • C++ language features: class types in non-type template parameters, C++20 class template argument deduction rules, and noexcept as a part of the function type.
  • Code completion: postfix templates for coroutines.
  • Inlay hints: improved configurability for aggregate initialization hints.

Get the EAP build via the Toolbox App, or download it from our website. EAP builds are free to use and let you try out all the newest features, but you should note that these builds might be unstable, since they are works in progress.

DOWNLOAD RESHARPER C++ 2021.1 EAP

C++

In this update, we’ve added support for several new C++20 and C++17 language features.

  • Before C++20, non-type template parameters were limited to having scalar non-floating-point types. In line with other recent language changes, C++20 lifts this constraint in order to make compile-time programming easier and more expressive. You can now use your own classes that satisfy the structural type requirement (see P1907) as template parameters:
    Class types in non-type template parameters
  • The latest standard removes one more limitation: class template argument deduction is now consistent and works for aggregate templates, type aliases, and inherited constructors (see P1021). ReSharper C++ 2021.1 introduces support for the C++20 CTAD rules and adds a new code redundancy inspection that detects cases where the template arguments can be deduced:
    Class template argument deduction
  • Until C++17, the noexcept specification was not considered a part of the function type, and this caused a number of issues with the language type system. This defect was fixed in C++17 (see P0012), and ReSharper C++ now fully supports the new exception specification semantics:
    noexcept as a part of the function type

Code completion

One of the most promising new features in C++20 is coroutines. Coroutines are functions that can suspend and resume their execution while preserving their state. ReSharper C++ added support for coroutines in the 2018.2 update, but up until now code completion didn’t include support for the new coroutine-related syntax. Language support for coroutines includes two new expressions and a new statement, which are now available as Postfix Templates:

  • The co_await expression suspends execution until resumed.
    Postfix templates: co_await
  • The co_return statement completes execution and optionally returns a value.
    Postfix Templates: co_return
  • The co_yield expression suspends execution and returns a value.
    Postfix Template: co_yield

The co_await, co_return, and co_yield keywords will be also available in basic code completion starting with the 2021.1 EAP 2 build.

Inlay hints

In ReSharper C++ 2020.3, we introduced the new Push-to-Hint visibility mode, in which hints are hidden by default to save editor space but can be revealed with a keypress. You can now quickly change the visibility mode for different types of hints from the Alt+Enter context menu:

Change the visibility mode

We’ve also added a stop list for aggregate initialization hints: you can now configure a list of class patterns for which the aggregate initialization hints will always be hidden, independently of other preferences. The new stop list can be found along with other related settings on the new Environment | Inlay Hints | C++ | Aggregate Initialization options page. For convenience, you can also quickly add a class name to the stop list from the context menu:

Stop list for aggregate initialization hints

That’s all for now! If you have any feature requests or encounter any issues, please report them to our tracker. We’re listening!

DOWNLOAD RESHARPER C++ 2021.1 EAP

Your ReSharper C++ team
JetBrains
The Drive to Develop