Closed
Description
Affected rules
A15-4-4
Description
The exceptions library makes a conservative assumption about which functions will throw which exceptions. However, for this query that leads to false positives where an externally defined function is known to throw in certain circumstances, but this is not captured in the throw specification for the function.
Example
This function is erroneously identified as a candidate for noexcept
even though append
could throw an out_of_range
error.
std::string concat(const std::string& s1, const std::string& s2) {
std::string s3;
s3.reserve(s1.size() +s2.size());
s3.append(s1.c_str(), s1.size())
s3.append(s2.c_str(), s2.size()));
return s3;
}```