https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86524
Bug ID: 86524 Summary: std::less with pointer arguments not usable in static_assert in constexpr function Product: gcc Version: 8.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: david at doublewise dot net Target Milestone: --- This code worked in gcc 7.3, but no longer works as of 8.1 or trunk. #include <functional> void f1() { constexpr int x = 0; static_assert(!(&x < &x)); static_assert(!std::less<>{}(&x, &x)); } constexpr void f2() { constexpr int x = 0; static_assert(!(&x < &x)); static_assert(!std::less<>{}(&x, &x)); } In this example, the function f1 compiles fine, but f2 gives: > g++ -std=c++17 <source>: In function 'constexpr void f2()': <source>:12:19: error: non-constant condition for static assertion static_assert(!std::less<>{}(&x, &x)); ^~~~~~~~~~~~~~~~~~~~~~ Compiler returned: 1 The same problem occurs if using `std::less<int const *>` instead of `std::less<>`.