Break MSVC and Clang with this one weird trick!

A few weeks ago I came across some code that MSVC and Clang both rejected, but GCC accepted. The error messages are different in MSVC and Clang, so clearly I must have done something wrong, and GCC falsely accepts the code, right? I mostly minimized the code, and ended up with this. (Compiler Explorer link) struct S{}; template <class T> void foo(T) { (void)[]<class U>(U) consteval -> bool {…