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 libstdc++/12549] New: Compile error on attempt to use pointer to member function with iterator


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Compile error on attempt to use pointer to member
                    function with iterator
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pavenis at latnet dot lv
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu

The following example doesn't compile both with gcc-3.3.1 and 
gcc-3.4 20031008 (experimental). See error message below.
It's possible to workaround the problem by using 2 lines which are 
commented out in the loop.

 
#include <vector>

struct foo
{
   void a (void);
   void b (void);

   int x;
};


void bar ( void (foo::*funct) (void),
           std::vector<foo> & data )
{
   for (std::vector<foo>::iterator iter=data.begin();
        iter!=data.end();
        ++iter)
   {
      (iter->*funct)();
      //foo & tmp = *iter;
      //(tmp.*funct)();
   }
}

I'm getting following output from /disk2/gcc34/bin/gcc -v -c mfp1.cc:

Reading specs from /disk2/gcc34/lib/gcc/i686-pc-linux-gnu/3.4/specs
Configured with: ../gcc/configure --prefix=/disk2/gcc34 --enable-shared
--verbose --$
Thread model: posix
gcc version 3.4 20031008 (experimental)
 /disk2/gcc34/libexec/gcc/i686-pc-linux-gnu/3.4/cc1plus -quiet -v -D_GNU_SOURCE
mfp1$
ignoring nonexistent directory
"/disk2/gcc34/lib/gcc/i686-pc-linux-gnu/3.4/../../../$
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/qt-3.2.1/include
 /disk2/gcc34/lib/gcc/i686-pc-linux-gnu/3.4/../../../../include/c++/3.4
 /disk2/gcc34/lib/gcc/i686-pc-linux-gnu/3.4/../../../../include/c++/3.4/i686-pc-linu$
 /disk2/gcc34/lib/gcc/i686-pc-linux-gnu/3.4/../../../../include/c++/3.4/backward
 /usr/local/include
 /disk2/gcc34/include
 /disk2/gcc34/lib/gcc/i686-pc-linux-gnu/3.4/include
 /usr/include
End of search list.
GNU C++ version 3.4 20031008 (experimental) (i686-pc-linux-gnu)
        compiled by GNU C version 3.4 20031008 (experimental).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
mfp1.cc: In function `void bar(void (foo::*)(), std::vector<foo,
std::allocator<foo>$
mfp1.cc:19: error: no match for 'operator->*' in 'iter ->* funct'


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