Resharper C++ 20 module support wants to add forward declaration Follow
I have created a project from the Named modules tutorial C++ using the steps in the web-site using vs2022 17.4.3 and Resharper c++ 2022.3.1
The project compiles and runs correctly.
However, Resharper incorrectly suggest in the module unit implementation file - BasicPlane.Figures-Rectangle.cpp - that a forward declaration for Rectangle is required, highlights the class name and provides a popup to make the fix. However, the fix is unnecessary. See the image below:
If the fix is applied, then further errors are indicated (Type Rectangle is incomplete). See below:
I have been able to turn off the fix popup but not remove the red highlighting. Is there some way of turning off the fix suggestion altogether? Is there any other work around?
Please sign in to leave a comment.
Could you please send us your project for investigation? You can upload it to https://uploads.jetbrains.com/, let us know the upload id.
Upload ID: 2023_01_02_2cLp6sA4dzXFKTKW26DGvk
I believe both the MSVC compiler and the tutorial are incorrect and that you need "import :Rectangle;" in BasicPlane.Figures-Rectangle.cpp to make the code conforming to the standard.
I've filed an issue with MS with my reasoning - https://developercommunity.visualstudio.com/t/%D0%A120-modules:-a-partition-implementatio/10243503, take a look if you're interested in details.
One more note. According to the C++ standard (https://eel.is/c++draft/module#unit-3), it looks like a single module partition cannot be defined in multiple module units, e.g. a .cpp and an. ixx files:
Thanks for the feedback