Code analysis incorrectly errors on const char* / string

Hello. I have a function signature like so:

   void Logger::init(const std::string& fn)

When I use this as so:

   Logger::init("\\work\\my_log.txt");

Resharper C++ incorrectly flags this as an error, stating:

   Cannot convert lvalue of type const char[23] to parameter type const std::string

This of course is untrue and the project builds and runs fine. The error stripes are nonetheless distracting. How can I correct this inspection in Resharper C++ without disabling all Code Inspection?

Regards,

Chris

7 comments
Comment actions Permalink

Hello,

Could you please share your solution where this happens or create a new one and send it to us for investigation? Thanks!

0
Comment actions Permalink

Thank you for the reply, Igor.

This error struck me as so unusual that I decided to create a new solution to test with. In the new solution, there is no Inspection error.

I fear that the underlying cause for this inspection failure is this: the solution is being built in VS2019 using the Microsoft Flight Simulator 2020 SDK, which uses :

  Platform Toolset: Microsoft Flight Simulator

instead of :

  Platform Toolset: Visual Studio 2019 (v142)

Is this possibly/probably the root cause of the inspection failure?

Regards,
Chris

0
Comment actions Permalink

It might be, could you please try changing the platform toolset in your new solution and check if the error appears?

0
Comment actions Permalink

I'm afraid I cannot change the platform toolset to Microsoft Flight Simulator once the solution is created -- but I can create a new solution that uses the  MSFS toolset using the Visual Studio new project wizard.

I've done this and the new solution demonstrates the problem I initially reported. The problem does seem to be dependent on this toolset (or something related to it).

I'm happy to send this solution to you for examination but:

1. You'll need the MSFS dev tools to be able to build it.

2. I don't see a way to attach binaries to you here.

Regards,
Chris

0
Comment actions Permalink

Thanks a lot! I've created https://youtrack.jetbrains.com/issue/RSCPP-31559, please attach the project there. Now that we've narrowed it down, could you please also collect some debugging info and attach it to the same request? Start Visual Studio with the /ReSharper.Internal command-line argument. Open a file with the issue, run these two commands and attach the resulting logs to the issue:

  • Alt+Enter, type "Dump C++ IntelliSense info".
  • Alt+Enter, type "Dump inclusion context".

If possible, could you please also share a link to the MSFS SDK download? Seems like it's available from the game.

0
Comment actions Permalink

I am grateful for your help!

  • I've attached the project to the youtrack issue.
  • Here's a link to the MSFS SDK - it's not a public download, so I retrieved it and put it on my Dropbox for you (1.5 GB) : https://www.dropbox.com/s/zl5xlnqrjs8h1xw/MSFS_SDK_Installer_0.9.0.0.msi?dl=0
  • (Please let me know once retrieved, and I'll remove the file.)
  • I started VS as specified and ran the two Dump commands. However, nothing happened - nothing appeared onscreen and if the dumps were saved some place, I'm afraid I don't know the location.

Regards,

Chris

0
Comment actions Permalink

Thanks, downloaded the SDK.

0

Please sign in to leave a comment.