[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

out_of_range



Probably, I've found an error in libstdc++. I can't catch "out_of_range"
exception.

This is the code:
=== begin ===
#include <vector>

using namespace std;

int func (vector <int> vec, unsigned idx)
{
 try { return vec[idx]; }
 catch (out_of_range e) { /* do smth */ }
}
=== end ===

After a command "g++ -c error.cpp" a compiler says:
=== begin ===
error.cpp: In function `int func(vector<int,allocator<int> >, unsigned int)':
error.cpp:8: parse error before `e'
error.cpp:8: confused by earlier errors, bailing out
=== end ===




Reply to: