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]

c++/5125: both g++ 3.0.1 and 2.95.3 crash with internal error when trying compile template method with parameter pointer to method



>Number:         5125
>Category:       c++
>Synopsis:       both g++ 3.0.1 and 2.95.3 crash with internal error when trying compile template method with parameter pointer to method
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 15 07:06:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Dmitri Lenev
>Release:        3.0.1 (SuSE)
>Organization:
>Environment:
System: Linux dlenev 2.4.10-4GB #1 Tue Sep 25 12:33:54 GMT 2001 i686 unknown
Architecture: i686

	
host: i486-suse-linux-gnu
build: i486-suse-linux-gnu
target: i486-suse-linux-gnu
configured with: ../configure --enable-threads=posix --enable-long-long --prefix=/opt/experimental --with-local-prefix=/usr/local --enable-languages=c,c++,f77,objc,java --disable-nls --enable-shared i486-suse-linux
>Description:
	both g++ 3.0.1 and 2.95.3 crash with internal error when trying compile next code:

>How-To-Repeat:

// Code starts
typedef unsigned int size_t;

class SerializationStream
{
public:
  template <class I> size_t serialize(const I& item);
  template <class I> size_t serializeMember(unsigned int member, const I& item);

  template <class I> size_t serializeMember(unsigned int member, const I& item,
      size_t (I::* serialization_function)(SerializationStream& stream) const );

private:
};

template <class I>
inline
size_t
SerializationStream::serialize(const I& item)
{
  return item.serialize(*this);
}

template<>
inline
size_t
SerializationStream::serialize<unsigned int>(const unsigned int & item)
{
  return sizeof(int);
}

template <class I>
inline
size_t
SerializationStream::serializeMember(unsigned int member, const I& item)
{
    serialize(member);
    size_t valueSize = serialize(item);
    serialize(valueSize);
    return sizeof(int) + sizeof(int) + valueSize;
}

template <class I>
inline
size_t
SerializationStream::serializeMember(unsigned int member, const I& item ,
          size_t (I::* serialization_function)(SerializationSream& stream) const )
{
    serialize(member);
    size_t valueSize = item.*serialization_function(*this);
    serialize(valueSize);
    return sizeof(int) + sizeof(int) + valueSize;
}

int
main(int argc, char **argv)
{
}

// end code
Preprocessor code almost matches source

>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]