So I'm perplexed as to how this works. Given:
template <typename T>
int foo(T t) { t.foo(); }
It seems like this call should fail:
decltype(foo(int{ 13 })) fail = 42;
cout << fail << endl;
Instead it just prints:
42
It works this way on all the compilers I have access to. Is this correct behavior? I request a quote from the C++ Standard.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…