This is the mail archive of the gcc-prs@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]

c++/4836: internal error with ptr to member function in template



>Number:         4836
>Category:       c++
>Synopsis:       internal error with ptr to member function in template
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Nov 08 13:56:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     william.dowling@isinet.com
>Release:        2.95.4
>Organization:
>Environment:
Linux wdowlingpc 2.2.18pre21 #1 Sat Nov 18 18:47:15 EST 2000 i686 unknown
>Description:
When I compile foo.cpp, I get an internal error:
$ g++ -Wall foo.cpp
foo.cpp: In method `bool CTFieldVec::generic_get_member<const CTFieldData, bool>(int, bool (CTFieldData::*)() const) const':
foo.cpp:17:   instantiated from here
foo.cpp:23: Internal compiler error.
foo.cpp:23: Please submit a full bug report.
foo.cpp:23: Internal compiler error:
foo.cpp:23: See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

Here is foo.cpp:
#include <vector>

class CTFieldData {
  public:
    CTFieldData(){}
    virtual ~CTFieldData() {}
    bool    get_valid()         const {return valid;}
  private:
    bool valid; 
};

class CTFieldVec {
  public:
    CTFieldVec();
    ~CTFieldVec();
    bool is_valid(int i) const
        {return generic_get_member(i, &CTFieldData::get_valid);}
  private:
    vector<CTFieldData *> the_fields;

    template <class U, class V>
    V generic_get_member(int i, V (U::* member)()) const
	{
	    return (the_fields[i].*member)();
	}

};

int main(){}


>How-To-Repeat:
Run  g++ -Wall foo.cpp
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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