public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/26496]  New: Pointer to virtual member function.
@ 2006-02-28 13:17 dwoovseesp at kriocoucke dot mailexpire dot com
  2006-02-28 13:18 ` [Bug c++/26496] " dwoovseesp at kriocoucke dot mailexpire dot com
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: dwoovseesp at kriocoucke dot mailexpire dot com @ 2006-02-28 13:17 UTC (permalink / raw)
  To: gcc-bugs

The following code snipped causes an internal compiler error:

===
#include <algorithm>
#include <iostream>
#include <iterator>
#include <memory>
#include <string>

using namespace std;

class Distribution {
public:
  Distribution() { }

  virtual ~Distribution() { }

  virtual double sample();
};

double
Distribution::sample() 
{
   return rand();
}

typedef double (Distribution::* Pstd_mem)();

int
main()
{
   Distribution* rng(new Distribution());

   Pstd_mem ptr = &Distribution::sample;

   cout << (rng->*ptr)() << endl; // works

   generate_n(ostream_iterator<double>(cout, "\n"), 100,  mem_fun(rng->*ptr));
// BUG

   return 0;
}
===

Best wishes,

  Matthias


-- 
           Summary: Pointer to virtual member function.
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dwoovseesp at kriocoucke dot mailexpire dot com


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


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2007-02-03 16:19 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-28 13:17 [Bug c++/26496] New: Pointer to virtual member function dwoovseesp at kriocoucke dot mailexpire dot com
2006-02-28 13:18 ` [Bug c++/26496] " dwoovseesp at kriocoucke dot mailexpire dot com
2006-02-28 13:30 ` dwoovseesp at kriocoucke dot mailexpire dot com
2006-02-28 13:32 ` pinskia at gcc dot gnu dot org
2006-02-28 13:46 ` dwoovseesp at kriocoucke dot mailexpire dot com
2006-02-28 13:48 ` pinskia at gcc dot gnu dot org
2006-02-28 14:07 ` [Bug c++/26496] [3.4/4.0/4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
2006-02-28 17:21 ` pinskia at gcc dot gnu dot org
2006-03-11  3:20 ` mmitchel at gcc dot gnu dot org
2006-05-31  4:38 ` [Bug c++/26496] [4.0/4.1/4.2 Regression] Pointer to " mmitchel at gcc dot gnu dot org
2006-05-31 20:04 ` mmitchel at gcc dot gnu dot org
2006-05-31 20:04 ` mmitchel at gcc dot gnu dot org
2006-05-31 20:11 ` mmitchel at gcc dot gnu dot org
2006-05-31 20:12 ` [Bug c++/26496] [4.0 " mmitchel at gcc dot gnu dot org
2007-02-03 16:19 ` gdr at gcc dot gnu dot org

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).