This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/71010] New: error: 'begin' was not declared in this scope
- From: "theubik at mail dot ru" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 08 May 2016 16:41:22 +0000
- Subject: [Bug c++/71010] New: error: 'begin' was not declared in this scope
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71010
Bug ID: 71010
Summary: error: 'begin' was not declared in this scope
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: theubik at mail dot ru
Target Milestone: ---
For example:
// https://godbolt.org/g/Zp5ABy
#include <iostream>
class X
{
int m_x[5] = { 0, 1, 2, 3, 4 };
public:
int* first() { return &m_x[0]; }
int* last() { return &m_x[4]; }
};
namespace std
{
int* begin(X& x) { return x.first(); }
int* end(X& x) { return x.last(); }
}
int main()
{
X x;
for (auto xi : x) // error: 'begin' was not declared in this scope
std::cout << xi << std::endl;
return 0;
}
With gcc 4.8 is OK. This is bug?