Bug in the MSVS C++ compiler on Codeforces?

Правка en1, от _vanger_, 2023-06-23 04:35:41

I noticed a strange behavior when choosing the Microsoft Visual C++ 17 language. Structured binding is handled incorrectly.

Let's be concrete. I tried to solve that problem: https://codeforces.net/contest/1843/problem/E and noticed that exactly the same code leads to different decisions on different compilers. Namely, it was accepted when choosing G++17 (as well as G++20, Clang++20): https://codeforces.net/contest/1843/submission/210710990 and when choosing VC++17 it gave wrong answer on test 1: https://codeforces.net/contest/1843/submission/210711015 A small investigation showed that the problem was in the lines when I filled a vector of pairs using structured binding:

vector<pair<int, int>> segments(m);
for (auto& [l, r] : segments)
    cin >> l >> r;

As one can see from this submission: https://codeforces.net/contest/1843/submission/210711251 elements of the vector are not filled with input values for some reason, and remain the default zeroes.

I want to add that I couldn't reproduce the bug on my version of MSVC++ (Version 17.5.3). The problem was only with the compiler on the server. Is it some known bug of the MSVC++ compiler used on Codeforces? If it is, are there some more that are commonly known?

Теги bug, c++17, msvc++

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский _vanger_ 2023-06-23 04:54:21 176
en1 Английский _vanger_ 2023-06-23 04:35:41 1296 Initial revision (published)