Some information that may be of interest ... (or not, as the case may be)
1. The assembler generated by the C compiler
mov eax, DWORD PTR ?i@?1??ctest@@9@9
add eax, 1
mov DWORD PTR ?i@?1??ctest@@9@9, eax
mov ecx, DWORD PTR ?i@?1??ctest@@9@9
mov DWORD PTR tv69[ebp], ecx
mov edx, DWORD PTR ?i@?1??ctest@@9@9
add edx, 1
mov DWORD PTR ?i@?1??ctest@@9@9, edx
mov eax, DWORD PTR ?i@?1??ctest@@9@9
push eax
mov ecx, DWORD PTR ?i@?1??ctest@@9@9
push ecx
mov edx, DWORD PTR tv69[ebp]
push edx
push OFFSET $SG10501
call _printf
2. The assembler generated by the C++ compiler
mov eax, DWORD PTR ?i@?1??CppTest@@YAHXZ@4HA
add eax, 1
mov DWORD PTR ?i@?1??CppTest@@YAHXZ@4HA, eax
mov ecx, DWORD PTR ?i@?1??CppTest@@YAHXZ@4HA
mov DWORD PTR tv75[ebp], ecx
mov edx, DWORD PTR ?i@?1??CppTest@@YAHXZ@4HA
mov DWORD PTR tv73[ebp], edx
mov eax, DWORD PTR ?i@?1??CppTest@@YAHXZ@4HA
mov DWORD PTR tv69[ebp], eax
mov ecx, DWORD PTR ?i@?1??CppTest@@YAHXZ@4HA
add ecx, 1
mov DWORD PTR ?i@?1??CppTest@@YAHXZ@4HA, ecx
mov edx, DWORD PTR tv75[ebp]
push edx
mov eax, DWORD PTR tv73[ebp]
push eax
mov ecx, DWORD PTR tv69[ebp]
push ecx
push OFFSET $SG64299
call _printf
Interestingly, if I remove the "-std:c++latest" option from the build
of the .cpp version, I get the result "2 3 3".