3 ms·
This is known as "the most vexing parse". In 99.9% of cases, it's just a surprising compiler error message that you learn to avoid. However, there's a related
by slavik81 5y ago
This is known as "the most vexing parse".
In 99.9% of cases, it's just a surprising compiler error message that you learn to avoid. However, there's a related version of this problem which can lead to accidentally declaring a function prototype rather than acquiring a lock. You'll get compiler warnings from -Wshadow, but the seriousness of the problem might not be obvious.
That said, it's a very rare problem these days, due to the introduction of uniform initialization in C++11.