libstdc++/2989: libstdc++ breaks compilation of strcpy

dmuell@gmx.net dmuell@gmx.net
Tue May 29 05:56:00 GMT 2001


>Number:         2989
>Category:       libstdc++
>Synopsis:       ambiguous overload of strcpy when including iostream
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Tue May 29 05:56:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Dirk A. Mueller
>Release:        3.0 20010529 (prerelease)
>Organization:
>Environment:
System: Linux 2.4.4
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../configure --enable-languages=c,c++ --enable-shared --enable-threads --enable-c99 --enable-long-long
>Description:

this code does no longer compile: 

=== Cut ===
#include <string.h>
#include <iostream>

using namespace std;

int main() {
  char foo[300];
  char* bar = "foo";

  strcpy(foo, bar);
}
=== Cut ===

the error message is: 

 call of overloaded `strcpy(char[300], char*&)' is ambiguous
/usr/include/string.h:78: candidates are: char* strcpy(char*, const char*)
/usr/local/include/g++-v3/bits/std_cstring.h:104:                 char* 
   std::strcpy(char*, const char*)

it worked fine with the gcc of a few days ago and with gcc 2.95.3 as all
previous releases (of course, as they didn't handle namespace conflicts)

>How-To-Repeat:
>Fix:

none known except removing the "using namespace" directive. 

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



More information about the Gcc-prs mailing list