http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48994
Summary: error for trivial use of range-based 'for'
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
GCC trunk (r173706) gives an error for the following trivial use of range-based
'for':
#include <vector>
void f(const std::vector<int>& v)
{
for (int i : v)
;
}
The error is:
test.cpp: In function ‘void f(const std::vector<int>&)’:
test.cpp:5:18: error: range-based ‘for’ expression of type ‘const
std::vector<int>’ has incomplete type
The error goes away if I change the function to take the vector by value rather
than reference.
GCC 4.6 compiles the code fine.