public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/8572: ICE with external definition of conversion operator to internal class within template class
@ 2002-11-20  7:03 llib
  0 siblings, 0 replies; only message in thread
From: llib @ 2002-11-20  7:03 UTC (permalink / raw)
  To: gcc-gnats


>Number:         8572
>Category:       c++
>Synopsis:       ICE with external definition of conversion operator to internal class within template class
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 13 21:26:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Bill Clarke
>Release:        3.3 20021110 (experimental)
>Organization:
>Environment:
System: SunOS alto 5.9 Generic sun4u sparc SUNW,Sun-Blade-1000
Architecture: sun4
host: sparc-sun-solaris2.9
build: sparc-sun-solaris2.9
target: sparc-sun-solaris2.9
configured with: ../gcc/configure --enable-languages=c,c++
>Description:
internal compiler error with legal code (see How-To-Repeat) results in
internal compiler error: 
templ-bug.cc:18: internal compiler error: in mangle_conv_op_name_for_type, at 
   cp/mangle.c:2612

The problem occurs with a template class X<T>, that has a conversion
operator to a pointer to an internal class X<T>::Y, where the conversion
operator is defined external to the class.

The problem does not occur with Z, since it is defined within the
template definition.

>How-To-Repeat:
compile this code:
// templ-bug.cc
template <typename T>
struct X {
  struct Y {
    Y() { }
  };
  operator Y* () const;

  struct Z {
    Z() { }
  };
  operator Z* () const { return 0; }
};

// implementation:

template <typename T>
X<T>::operator typename X<T>::Y*() const { // this is line 18
  return 0;
}
// eof

? ~/incoming/gcc-mainline-cvs/install/bin/g++ -c templ-bug.cc
templ-bug.cc:18: internal compiler error: in mangle_conv_op_name_for_type, at 
   cp/mangle.c:2612
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
?

>Fix:
workaround: define the conversion operator within the class.
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-11-14  5:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-20  7:03 c++/8572: ICE with external definition of conversion operator to internal class within template class llib

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