https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94564
Bug ID: 94564 Summary: C++20: Three-way comparison between pointer and nullptr accepted Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: daniel.kruegler at googlemail dot com Target Milestone: --- The following program is accepted when compiling against C++20, but should be rejected, because the C++20 working draft does not support three-way comparison between pointer and std::nullptr_t (See [expr.spaceship] p6): Compiler options: -Wall -Wextra -pedantic -std=c++20 //------------------- #include <compare> template<class T, decltype((((T*) 0) <=> nullptr), true) = false> void test(T*) { } int main() { test((int*)(nullptr)); } //-------------------