Bug 12550 - Compile error on attempt to use pointer to member function with iterator
Summary: Compile error on attempt to use pointer to member function with iterator
Status: RESOLVED DUPLICATE of bug 12549
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-09 13:21 UTC by Andris Pavenis
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andris Pavenis 2003-10-09 13:21:31 UTC
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'
Comment 1 Andris Pavenis 2003-10-09 13:25:28 UTC
Sorry for duplicate submission

*** This bug has been marked as a duplicate of 12549 ***