c++/8990: most algorithms in <algorithm> should require being qualified by std:: but aren't
dean@foster.net
dean@foster.net
Wed Dec 18 08:16:00 GMT 2002
>Number: 8990
>Category: c++
>Synopsis: most algorithms in <algorithm> should require being qualified by std:: but aren't
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: accepts-illegal
>Submitter-Id: net
>Arrival-Date: Wed Dec 18 08:16:05 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: dean@foster.net
>Release: gcc 3.2
>Organization:
>Environment:
linux
>Description:
Most of the algorithms (max_element, find_if, etc) in algorithms should require the use of a std:: namespace qualifier. Thus incorrect code is currently being accepted.
>How-To-Repeat:
#include <algorithm>
#include <list>
int
main()
{
std::list<int> l;
std::max_element(l.begin(),l.end());
max_element(l.begin(),l.end()); // shouldn't compile, but is accepted
}
>Fix:
I think all that is required is adding a namespace around the include of stl_algo.h in the file <algorithm>. But, I'm guessing I'm missing something major here. :-)
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list