public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: dlenev@spylog.ru
To: gcc-gnats@gcc.gnu.org
Subject: 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
Date: Sat, 15 Dec 2001 07:06:00 -0000	[thread overview]
Message-ID: <20011215145951.35AFA1CF94@dlenev.local> (raw)


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


             reply	other threads:[~2001-12-15 15:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-15  7:06 dlenev [this message]
2001-12-15  7:21 rodrigc
2001-12-15  7:56 Dmitri Lenev
2001-12-29  7:32 nathan
2001-12-29  9:15 nathan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20011215145951.35AFA1CF94@dlenev.local \
    --to=dlenev@spylog.ru \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).