c++/10425: function index should not live in the global namespace

frank.schmitt@4sc.com frank.schmitt@4sc.com
Thu Apr 17 08:06:00 GMT 2003


>Number:         10425
>Category:       c++
>Synopsis:       function index should not live in the global namespace
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 17 08:06:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Frank Schmitt
>Release:        3.0.4, 3.1.1, 3.2.1 (not 2.96)
>Organization:
>Environment:
RedHat Linux 7.3, glibc-2.2.5-34, gcc 3.2.1
>Description:
gcc fails to compile a class named index if iostream is
included
>How-To-Repeat:
/* gccbug3.cpp
 *
 * compile with -Wall -ansi -pedantic
 * @author Frank Schmitt (frank.schmitt@4sc.com) 
 */

#include <iostream>

class index {
};

int main() {
  index i;
}
>Fix:
disable 
  char *index(const char *s, int c);
in string.h if compiled in strict ansi mode (probably rindex,
as well)
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-prs mailing list