| Issue |
87406
|
| Summary |
poor diagnostic on invalid format string inside a lambda
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
janwilmans
|
I know I'm using {fmt} here in the example but that is for the sake of comparison, the diagnostic is similarly bad with std::format, see the second godbolt link at the botton for an {fmt}-free example.
```
#include <fmt/core.h>
#include <string>
#include <functional>
// std::string example()
// {
// return fmt::format("{.3}\n", 0);
// }
std::function<std::string()> example = []
{
return fmt::format("{.3}\n", 0);
};
int main()
{
return example().size();
}
```
when the format-string is invalid inside the lamdba, the diagnostic is very confusing. I can understand why, and I'm sure anything can be done about it, however, it seems to me that the error-handling strategy used in {fmt} is not working anymore in later versions of clang.
[godbolt link](https://cppcoach.godbolt.org/z/crnevsWeK) using {fmt} as an example of the `throw_format_error("invalid format string");` being displayed.
[godbolt link](https://cppcoach.godbolt.org/z/qTYf7accE) using std::format showing that inside a lamdba the std::format diagnostic is very poor
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs