I'm compiling this code with gcc 11.2.0 and the -Wuninitialized
switch, but I don't get any warning in spite of bar_uninitialized
being used uninitialized:
#include <vector>
#include <iostream>
using std::vector;
using std::cout;
void foo(int dist, int tank, vector<int>& v)
{
size_t bar_uninitialized;
while (bar_uninitialized <= v.size())
{
bar_uninitialized++;
cout << bar_uninitialized << "\n";
}
}
int main()
{
vector<int> v;
foo(3, 3, v);
}
Is this a gcc compiler bug?