public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/6730: Crash involving templates when compiling program
@ 2002-05-19 22:16 bbaetz
0 siblings, 0 replies; 2+ messages in thread
From: bbaetz @ 2002-05-19 22:16 UTC (permalink / raw)
To: gcc-gnats
>Number: 6730
>Category: c++
>Synopsis: Crash involving templates when compiling program
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: ice-on-legal-code
>Submitter-Id: net
>Arrival-Date: Sun May 19 22:16:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Bradley Baetz
>Release: 3.2 20020519 (experimental)
>Organization:
>Environment:
System: Linux tomato.home 2.4.18 #8 Thu Feb 28 22:43:37 EST 2002 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc/configure --prefix=/home/bbaetz/gcc/ --enable-languages=c,c++,treelang --enable-threads=posix --disable-checking
>Description:
I was attempting to get the testcase in
http://groups.google.com/groups?selm=1018969434.13641.0.nnrp-07.3e31d362%40news.demon.co.uk
to work.
Uncommenting either of the usages of has_subscript_operator in main causes
a crash:
sub.cpp: In instantiation of `has_subscript_operator<int>':
sub.cpp:13: instantiated from here
sub.cpp:6: internal error: Segmentation fault
The first line is obviously illegal (a typo I made while I was playing
with the testcase), but I believe that the second should be OK.
>How-To-Repeat:
template<typename T>
class has_subscript_operator
{
private:
template <int> struct helper {};
template <class U> static int foo( helper<sizeof( &U::operator[] )> * );
public:
int value() { return 0; };
};
int main() {
// return has_subscript_operator<int>::value;
return has_subscript_operator<int>().value();
}
g++ -Wall sub.cc
>Fix:
Removing the unused template functions (which are unused in this
example) from the class avoids the crash.
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: c++/6730: Crash involving templates when compiling program
@ 2002-05-22 7:08 lerdsuwa
0 siblings, 0 replies; 2+ messages in thread
From: lerdsuwa @ 2002-05-22 7:08 UTC (permalink / raw)
To: bbaetz, gcc-bugs, gcc-prs, nobody
Synopsis: Crash involving templates when compiling program
State-Changed-From-To: open->analyzed
State-Changed-By: lerdsuwa
State-Changed-When: Wed May 22 07:08:40 2002
State-Changed-Why:
Confirmed.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6730
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-05-22 14:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-19 22:16 c++/6730: Crash involving templates when compiling program bbaetz
2002-05-22 7:08 lerdsuwa
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).