This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


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

[3.0 regression] libstdc++ and strstr


The following most trivial code snippet fails to compile with current
CVS sources on the GCC 3.0 branch on i686-pc-linux-gnu:

  #include <string>

  using namespace std;

  char *f() {
    strstr("aba","b");
    }

This is the failure mode:

  % gccvs x.cc
  x.cc: In function `char *f()':
  x.cc:6: call of overloaded `strstr(const char[4], const char[2])' is ambiguous
  /usr/include/string.h:178: candidates are: char* strstr(const char*, const char*)
  /sw/gcc/include/g++-v3/bits/std_cstring.h:125:
     char* std::strstr(char*, const char*)
  /sw/gcc/include/g++-v3/bits/std_cstring.h:121:
     const char* std::strstr(const char*, const char*)

(The return of f() does not matter; either void, char*, or const char*
result in the same error.)

Gerald

PS: I'll take care of filing a formal GNATS PR, unless we can address this
today or tomorrow...
-- 
Gerald "Jerry" pfeifer@dbai.tuwien.ac.at http://www.dbai.tuwien.ac.at/~pfeifer/


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