We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$ clang++.exe --version clang version 11.0.0 (https://github.com/llvm/llvm-project.git fc3c80c)
$ cat test.cpp #ifdef BUG template #endif struct test_t { template int exec(U) { if constexpr (requires { this->is_memmovable(); }) return 1; else return 0; }
template requires false auto is_memmovable() -> void; };
int test() { #ifdef BUG using test_type = test_t; #else using test_type = test_t; #endif
return test_type{}.exec(0); }
$ clang++.exe -std=c++2a -O3 -c -S -o - test.cpp -DBUG "?test@@yahxz": # @"?test@@yahxz"
movl $1, %eax retl
$ clang++.exe -std=c++2a -O3 -c -S -o - test.cpp "?test@@yahxz": # @"?test@@yahxz"
xorl %eax, %eax retl
The requires expression only gives the wrong result if test_t is a template. Otherwise it correctly evaluates to false.
The text was updated successfully, but these errors were encountered:
Fixed, thanks for reporting :)
Sorry, something went wrong.
Oh that was quick, thanks Saar.
I think it fixed another problem i was having. I've tried to create a minimal repro yesterday, but Clang didn't crash.
I was wondering, is it possible to backport the fix to the release/10.x branch?
I believe it was back ported, check the rc4 build
It`s not working with rc4.
I`ve checked the commits at https://github.com/llvm/llvm-project/commits/release/10.x, and the commit that fixed the issue is not listed there.
Saar's fix will in rc5.
No branches or pull requests
Extended Description
$ clang++.exe --version
clang version 11.0.0 (https://github.com/llvm/llvm-project.git fc3c80c)
$ cat test.cpp
#ifdef BUG
template
#endif
struct test_t {
template
int exec(U) {
if constexpr (requires { this->is_memmovable(); })
return 1;
else
return 0;
}
template
requires false
auto is_memmovable() -> void;
};
int test() {
#ifdef BUG
using test_type = test_t;
#else
using test_type = test_t;
#endif
return test_type{}.exec(0);
}
$ clang++.exe -std=c++2a -O3 -c -S -o - test.cpp -DBUG
"?test@@yahxz": # @"?test@@yahxz"
%bb.0:
$ clang++.exe -std=c++2a -O3 -c -S -o - test.cpp
"?test@@yahxz": # @"?test@@yahxz"
%bb.0:
The requires expression only gives the wrong result if test_t is a template. Otherwise it correctly evaluates to false.
The text was updated successfully, but these errors were encountered: