Issue with rule "Exceptions should not be thrown in "noexcept" functions" in c++

We are using SonarCloud (so the last version) but the rule RSPEC-3743 is not always working, and not detecting wrong “noexcept”

Here a very simple example where there is the warning on g2, but NOT on g1…
BUT the two methods f1 and f2 are very similar

It seems to be a bug in the detection!

#include <filesystem>
#include <exception>

void f2(const std::string& _pathToFile)
    if (!_pathToFile.empty()) throw std::exception("bad");

void g2() noexcept

void f1(const std::filesystem::path& _pathToFile)
    if (std::filesystem::exists(_pathToFile)) throw std::exception("bad");

void g1() noexcept

Hello @Laurent,

Thank you for reporting this!
I was able to reproduce the false negative you mention, so I created a ticket (CPP-3255) to fix that. You’re right, there seems to be a bug on our side.


I see the bug is resolved in 6.26 but trying to install the new build wrapper from I still get the version 6.25…

When it will be available?

The 6.26 version of the CFamily plugin will be available in SonarQube 9.1 that is planned to be released the 17th on September.


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