#include <cstdio>
struct T1 {};
struct T2 {};
struct U1 {};
struct U2 {};
struct A {
using T = T1;
using U = U1;
operator U1 T1::*() { return nullptr; }
operator U1 T2::*() { return nullptr; }
operator U2 T1::*() { return nullptr; }
operator U2 T2::*() { return nullptr; }
};
inline auto which(U1 T1::*) { return "gcc"; }
inline auto which(U1 T2::*) { return "icc"; }
inline auto which(U2 T1::*) { return "msvc"; }
inline auto which(U2 T2::*) { return "clang"; }
int main() {
A a;
using T = T2;
using U = U2;
puts(which(a.operator U T::*()));
return 0;
}
真的可以在不同编译器输出不同结果😄