cpp:S878 & S905 false-positive with multiple lines rvalue array

image

#include <array>;

int main(){
auto queuePriorities = std::to_array<float>({
		1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
		1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, //<-- S878 & S905
		1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, //<-- S878 & S905
		1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, //<-- S878 & S905
		1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 
		1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, });
}

C++20
S878 & S905
SonarLint - Visual Studio Community 2022 17.6.5

Hi,

Welcome to the community!

I think you’ve given us your version of Visual Studio. What’s your SonarLint version? Note that 7.1.0.75242 dropped today, so if you’re not already on it, can you upgrade and make sure this is still replicable?

 
Thx,
Ann

I have updated it to the latest version. The problem persists

1 Like

Hi Theramar

This is indeed a false-positive in our C++ analyzer. The root cause here is the parsing error on the std::to_array identifier, which the analyzer fails to find because our C++20 support is still incomplete.

Thank you for reporting it. I have created CPP-4608 to track the issue.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.