Visual Studio C++ compiler weird behaviour
I'm just curious to know why this small piece of code compiles correctly (and without warnings) in Visual Studio . Maybe the result is the same with GCC and Clang , but unfortunately I can't test them now. struct T { int t; T() : t(0) {} }; int main() { T(i_do_not_exist); return 0; } T(i_do_not_exist); is an object declaration with the same meaning as T i_do_not_exist; . N4567 § 6.8[stmt.ambig]p1 There is an ambiguity in the grammar involving expression-statement s and declaration s: An expression-statement with a function-style explicit type conversion (5.2.3) as its leftmost subexpression