This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

libstdc++/2977: string.h doesn't always inject names into std::



>Number:         2977
>Category:       libstdc++
>Synopsis:       string.h doesn't always inject names into std::
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Sun May 27 22:06:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     scott snyder
>Release:        3.0 20010525 (prerelease)
>Organization:
>Environment:
System: Linux karma 2.2.16-22 #1 Tue Aug 22 16:49:06 EDT 2000 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../egcs/configure --prefix=/usr/local/egcs --enable-threads=posix --enable-long-long
>Description:

The program below doesn't compile: it appears that when used after
an #include <cstring>, then #include <string.h> doesn't get the
names injected into std::, as required by the standard.

gcc 2.95 compiles the example below without complaint, so this
could be considered a regression.

Reversing the order of the inclusions below makes the example
compile, as does adding a `using namespace std;'.  (Note, however,
that if one does _both_ of these, one gets a complaint about an ambiguous
call to strchr.)

>How-To-Repeat:

--------------------------------------------------------------------------
#include <cstring>
#include <string.h>

const char* foo (const char* s)
{
  return strchr (s, 'a');
}
--------------------------------------------------------------------------

$ g++ -c x.cc
x.cc: In function `const char* foo(const char*)':
x.cc:6: `strchr' undeclared (first use this function)
x.cc:6: (Each undeclared identifier is reported only once for each function it 
   appears in.)

>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]