[Bug c++/71010] error: 'begin' was not declared in this scope

manu at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon May 9 17:11:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71010

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #1)
 Furthermore, your code has undefined behaviour, it is forbidden to add your
> own functions to namespace std. The correct way to do it is to write the
> begin/end overloads in the same namespace as your type (in this case that's
> the global namespace).

I actually did not know that. Would it be possible to warn about this? I guess
libstdc++ files are system-headers and can avoid the warning.


More information about the Gcc-bugs mailing list