The following code results in:
#include <string>
struct S
{
std::string s;
};
as
#include <string>
struct S
{
std::basic_string<char> s;
};
There are no comments added.
The output of the bugprone-exception-escape clang-tidy check indicates that the constructor, destructor and and assignment operator are all implicitly generated (see https://godbolt.org/z/hT8cEK58x):
<source>:3:8: warning: an exception may be thrown in function 'S' which should not throw exceptions [bugprone-exception-escape]
<source>:3:8: warning: an exception may be thrown in function 'operator=' which should not throw exceptions [bugprone-exception-escape]
<source>:3:8: warning: an exception may be thrown in function '~S' which should not throw exceptions [bugprone-exception-escape]
Comments are added if the object is actually being instantiated.
#include <string>
struct S
{
std::string s;
};
void f()
{
S s;
}
results in
#include <string>
struct S
{
std::basic_string<char> s;
// inline ~S() noexcept = default;
// inline S() noexcept = default;
};
void f()
{
S s = S();
}
Requiring the additional code is rather misleading and the assignment operator is also missing (the latter should be split into a separate issue).
The following code results in:
as
There are no comments added.
The output of the
bugprone-exception-escapeclang-tidy check indicates that the constructor, destructor and and assignment operator are all implicitly generated (see https://godbolt.org/z/hT8cEK58x):Comments are added if the object is actually being instantiated.
results in
Requiring the additional code is rather misleading and the assignment operator is also missing (the latter should be split into a separate issue).