https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89300
Bug ID: 89300 Summary: C++ requires statement does not fail silently for const void * Product: gcc Version: 8.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: svenja.mehringer at gmail dot com Target Milestone: --- The following code snippet fails to compile with GCC 8.1/8.2/latest trunk on Godbolt because of the requires clause. From my understanding, the requires should just evaluate to false and remove the second foo overload from the list of possible candidates. ```cpp #include <type_traits> template <typename t> void foo() {} template <typename t> requires requires { std::is_integral_v<decltype(std::declval<t>() - std::declval<t>())>; } void foo() {} int main() { foo<const void *>(); } ``` see https://godbolt.org/z/iFW2MO The same code compiles fine with the clang experimental concept branch. The error message: ``` <source>: In function 'int main()': <source>:8:71: error: invalid use of 'const void' requires requires { std::is_integral_v<decltype(std::declval<t>() - std::declval<t>())>; } ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~ Compiler returned: 1 ``` Locally reproduced on : Using built-in specs. COLLECT_GCC=/import/GCC//8.2.0/bin/g++ COLLECT_LTO_WRAPPER=/import/GCC/8.2.0/bin/../libexec/gcc/x86_64-pc-linux-gnu/8.2.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ./configure --prefix=/data/scratch/skillen1105/gcc8.2/dest Thread model: posix gcc version 8.2.0 (GCC)