I looked up into the code and it really caused to happen in Visual Studio 16.7.7. Now it seems to be working fine in both in VS 16.8.3 and g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 (tried with -std=c++14), it was a bug which seems to be fixed by Microsoft team in the recent update.
CLICK HERE to find out more related problems solutions.