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]
Other format: [Raw text]

[Bug c++/22070] New: including iostream causes lookup of std function to fail when passed into STL algorithm


The inclusion of iostream breaks the following program.  A workaround is to define an inline function that calls into tolower() and use it as the last argument to transform().

Code:

#include <cctype>
#include <string>
#include <algorithm>
#include <iostream>

int main()
{
  std::string foo("AbCd");
  std::transform(foo.begin(), foo.end(), foo.begin(), std::tolower);
  return 0;
}

Output:

Reading specs from /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.4/specs
Configured with: ../gcc-3.4.4/configure --prefix=/usr/local --enable-languages=c++
Thread model: posix
gcc version 3.4.4
 /usr/local/libexec/gcc/i686-pc-linux-gnu/3.4.4/cc1plus -E -quiet -v -D_GNU_SOURCE foo.cpp -mtune=pentiumpro -o foo.ii
ignoring nonexistent directory "/usr/local/lib/gcc/i686-pc-linux-gnu/3.4.4/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.4/../../../../include/c++/3.4.4
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.4/../../../../include/c++/3.4.4/i686-pc-linux-gnu
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.4/../../../../include/c++/3.4.4/backward
 /usr/local/include
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.4/include
 /usr/include
End of search list.
 /usr/local/libexec/gcc/i686-pc-linux-gnu/3.4.4/cc1plus -fpreprocessed foo.ii -quiet -dumpbase foo.cpp -mtune=pentiumpro -auxbase foo -version -o foo.s
GNU C++ version 3.4.4 (i686-pc-linux-gnu)
	compiled by GNU C version 3.4.4.
GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129426
foo.cpp: In function `int main()':
foo.cpp:12: error: no matching function for call to `transform(__gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, <unknown type>)'

-- 
           Summary: including iostream causes lookup of std function to fail
                    when passed into STL algorithm
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jbeardsley at ncaustin dot com
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22070


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