public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17166] New: g++ 3.4.1 and 3.5 forget a template function definition
@ 2004-08-24 12:41 guillaume dot melquiond at ens-lyon dot fr
  2004-08-24 12:49 ` [Bug c++/17166] " guillaume dot melquiond at ens-lyon dot fr
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: guillaume dot melquiond at ens-lyon dot fr @ 2004-08-24 12:41 UTC (permalink / raw)
  To: gcc-bugs

When compiling the help.cpp file from Wesnoth CVS, both g++ 3.4.1 and 3.5 aren't
able to compile the following line. Previous versions of GCC and other compilers
don't have any problem with it.

show_info_about.erase(std::remove(show_info_about.begin(),
show_info_about.end(), gamemap::VOID_TERRAIN), show_info_about.end());

Here g++ seems to believe that the function std::remove is remove(const char *)
(file removal of the standard library). It doesn't see the stl_algo.h function.

help.cpp: In function `std::vector<help::topic, std::allocator<help::topic> >
help::generate_terrains_topics()':
help.cpp:849: error: cannot convert `__gnu_cxx::__normal_iterator<char*,
std::vector<char, std::allocator<char> > >' to `const char*' for argument `1' to
`int remove(const char*)'

However, the funny thing is that if I add the following lines just before, g++
compiles just fine the file.

typedef __typeof__ show_info_about.begin() iterator;
typedef __typeof__ gamemap::VOID_TERRAIN element;
iterator (*f)(iterator, iterator, element const &) = std::remove< iterator,
element >;

Please note that I don't use f afterwards. They really are dummy lines, f is
only here to verify that the remove function exists. And now g++ has suddenly
remembered that there is a std::remove with three arguments and it is now able
to find it at the next line.

$ LANG=C g++-3.4 -v
Reading specs from /usr/lib/gcc/i486-linux/3.4.1/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4
--enable-shared --with-system-zlib --enable-nls --without-included-gettext
--program-suffix=-3.4 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt
--enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm
--enable-java-awt=gtk --disable-werror i486-linux
Thread model: posix
gcc version 3.4.1 (Debian 3.4.1-7)

$ g++-3.5 -v
Reading specs from /usr/lib/gcc/i486-linux/3.5.0/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f95,objc
--prefix=/usr --libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.5
--enable-shared --with-system-zlib --enable-nls --enable-threads=posix
--without-included-gettext --program-suffix=-3.5 --enable-__cxa_atexit
--enable-libstdcxx-allocator=mt --enable-clocale=gnu --enable-libstdcxx-debug
--enable-java-gc=boehm --enable-java-awt=gtk i486-linux
Thread model: posix
gcc version 3.5.0 20040724 (experimental) (Debian 3.5-0pre1)

$ g++-3.5 -c bug.ii
help.cpp: In function `std::vector<help::topic, std::allocator<help::topic> >
help::generate_terrains_topics()':
help.cpp:849: error: cannot convert `__gnu_cxx::__normal_iterator<char*,
std::vector<char, std::allocator<char> > >' to `const char*' for argument `1' to
`int remove(const char*)'
help.cpp:851: error: cannot convert `__gnu_cxx::__normal_iterator<char*,
std::vector<char, std::allocator<char> > >' to `const char*' for argument `1' to
`int remove(const char*)'

Sorry for the huge test-case. I may try to reduce it later. Since it is that
big, I don't provide the modified file with the three dummy lines. However I
have verified that adding them to line 48553 of the preprocessed file is enough
for g++ 3.4.1 and 3.5 to compile the file successfuly.

-- 
           Summary: g++ 3.4.1 and 3.5 forget a template function definition
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: guillaume dot melquiond at ens-lyon dot fr
                CC: gcc-bugs at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 13+ messages in thread
[parent not found: <bug-17166-7904@http.gcc.gnu.org/bugzilla/>]
[parent not found: <bug-17166-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2013-06-21 14:49 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-24 12:41 [Bug c++/17166] New: g++ 3.4.1 and 3.5 forget a template function definition guillaume dot melquiond at ens-lyon dot fr
2004-08-24 12:49 ` [Bug c++/17166] " guillaume dot melquiond at ens-lyon dot fr
2004-08-24 13:33 ` bangerth at dealii dot org
2004-08-24 13:48 ` bangerth at dealii dot org
2004-08-24 14:07 ` reichelt at gcc dot gnu dot org
2004-08-24 14:28 ` guillaume dot melquiond at ens-lyon dot fr
2004-08-24 18:26 ` bangerth at dealii dot org
2004-10-28  3:58 ` [Bug c++/17166] Improve diagnostic for empty overload set listing the rejected overloads giovannibajo at libero dot it
2005-05-29 16:03 ` pinskia at gcc dot gnu dot org
2005-05-29 16:21 ` pinskia at gcc dot gnu dot org
2005-05-29 20:45 ` pinskia at gcc dot gnu dot org
     [not found] <bug-17166-7904@http.gcc.gnu.org/bugzilla/>
2005-11-25  8:31 ` guillaume dot melquiond at ens-lyon dot fr
     [not found] <bug-17166-4@http.gcc.gnu.org/bugzilla/>
2013-06-21 14:49 ` paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).