Issue |
144053
|
Summary |
Improve diagnostic of `static_assert(requires [...])`
|
Labels |
new issue
|
Assignees |
|
Reporter |
PJBoy
|
When a static assert over a requires _expression_ fails, clang gives no insight as to how the requires _expression_ was evaluated, it just shows the line literatim.
Clang does gives reasonable diagnostics when the same requires _expression_ evaluation causes a constraint failure. I have hope that this mechanism can be leveraged for `static_assert` too
Testcase https://godbolt.org/z/fnoW3aMM9
```c++
#include <concepts>
int g(int);
#if 0
// This diagnostic is reasonable
template<typename T>
requires requires (T t)
{
{ g(t) } -> std::same_as<void>;
}
void f()
{}
#else
template<typename T>
void f()
{
// This diagnostic is no good
static_assert(requires (T t)
{
{ g(t) } -> std::same_as<void>;
});
}
#endif
void test()
{
f<int>();
}
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs