// PR c++/92193 // { dg-do compile { target c++11 } } template struct has_foo { static constexpr bool value = false; }; template #ifndef NO_CONSTEXPR constexpr #endif bool foo(T t) noexcept(noexcept(t.foo())) { return t.foo(); } template void maybe_foo(T t) { static_assert( has_foo::value, "has foo" ); // { dg-error "has foo" } foo(t); } struct X { }; int main() { X x; maybe_foo(x); }