The clang-tidy check bugprone-exception-escape should ignore the consteval functions. These are only executed at compile time and if they throw an exception the compilation fails.
consteval int consteval_fn(int a)
{
if (a == 0)
throw 1;
return a;
}
int test() noexcept
{
return consteval_fn(1);
}
To trigger the warning you can call a consteval function with throw statement.
You can also mark such consteval function with noexcept. I'm not sure how to interpret the intention in the second case so may this is not worth fixing.
The clang-tidy check `bugprone-exception-escape` should ignore the `consteval` functions. These are only executed at compile time and if they throw an exception the compilation fails.
```cpp
consteval int consteval_fn(int a)
{
if (a == 0)
throw 1;
return a;
}
int test() noexcept
{
return consteval_fn(1);
}
```
https://godbolt.org/z/G9WGK3d56
To trigger the warning you can call a `consteval` function with `throw` statement.
You can also mark such `consteval` function with `noexcept`. I'm not sure how to interpret the intention in the second case so may this is not worth fixing.
The clang-tidy check
bugprone-exception-escape
should ignore theconsteval
functions. These are only executed at compile time and if they throw an exception the compilation fails.https://godbolt.org/z/G9WGK3d56
To trigger the warning you can call a
consteval
function withthrow
statement. You can also mark suchconsteval
function withnoexcept
. I'm not sure how to interpret the intention in the second case so may this is not worth fixing.