diff options
author | yronglin <yronglin777@gmail.com> | 2023-06-06 23:57:57 +0800 |
---|---|---|
committer | yronglin <yronglin777@gmail.com> | 2023-06-06 23:58:37 +0800 |
commit | 540294845babbb2be909ea456323d7bc8a1763df (patch) | |
tree | 8454a13fa3843438b144b1d863f50c9bd94d4768 /llvm/tools/llvm-objdump/llvm-objdump.cpp | |
parent | 2c0e152436c78aee3830d5f8003071532f7c8aac (diff) | |
download | llvm-540294845babbb2be909ea456323d7bc8a1763df.zip llvm-540294845babbb2be909ea456323d7bc8a1763df.tar.gz llvm-540294845babbb2be909ea456323d7bc8a1763df.tar.bz2 |
[Clang] Reject increment of bool value in unevaluated contexts after C++17
Clang now incorrectly allowed increment of bool in unevaluated contexts, we set `diagnostic::ext_increment_bool` to be SFINAEFailure to fix this issue.
```
template<class T> auto f(T t) -> decltype(++t);
auto f(...) -> void;
void g() {
f(true); // Clang wrongly makes this a hard error
}
```
```
template <class T>
concept can_increment = requires(T t) { ++t; };
template <class T> void f() {
static_assert(requires(T t) { ++t; }); // Incorrectly allowed
}
int main() {
f<bool>();
static_assert(!can_increment<bool>); // Incorrectly fails
bool b = false;
++b; // Correctly rejected
}
```
Fix issue: https://github.com/llvm/llvm-project/issues/47517
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D152259
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
0 files changed, 0 insertions, 0 deletions