public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: sfking00@hotmail.com To: gcc-gnats@gcc.gnu.org Subject: c++/6778: fails to compile template Date: Thu, 23 May 2002 00:06:00 -0000 [thread overview] Message-ID: <20020523065655.15107.qmail@sources.redhat.com> (raw) >Number: 6778 >Category: c++ >Synopsis: fails to compile template >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: ice-on-legal-code >Submitter-Id: net >Arrival-Date: Thu May 23 00:06:00 PDT 2002 >Closed-Date: >Last-Modified: >Originator: sfking00@hotmail.com >Release: Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/specs Configured with: ../../../../export/src/gcc-3.1/configure -enable-shared -enable-threads Thread model: posix gcc version 3.1 >Organization: >Environment: Red Hat 7.1 on a p2-400 w/256 megs ram, linux kernel 2.4.18 >Description: c++ -g -O0 -fmessage-length=0 -Wall -c test.cc test.cc:29: internal error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions. make: *** [test.o] Error 1 >How-To-Repeat: namespace { template < unsigned N, typename T = double > class X {}; template < unsigned N, typename T = double > class Y {}; template < unsigned N, typename T > Y < N - 1, T > operator * (X < N, T > const &, Y < N, T > const &) throw () { return Y < N - 1, T > (); } #if 1 template < unsigned N, typename T > Y < N + 1, T > operator * (X < N + 1, T > const &, Y < N, T > const &) throw () { return Y < N + 1, T > (); } #else template < unsigned N, typename T > Y < N, T > operator * (X < N, T > const &, Y < N - 1, T > const &) throw () { return Y < N, T > (); } #endif template Y < 1, double > operator * (X < 2, double > const &, Y < 2, double > const &) throw (); template Y < 2, double > operator * (X < 2, double > const &, Y < 1, double > const &) throw (); } int main () { try { } catch (...) { } return 0; } >Fix: the code inside the #if 1 will not compile with 3.1 but will with 3.0.4 and earlier, but change the #if 1 to #if 0 and it will compile with 3.1 but not with earlier versions of gcc. (either form compiles with the Comeau online compiler) >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/x-c++src; name="test.cc" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="test.cc" bmFtZXNwYWNlCnsKCXRlbXBsYXRlIDwgdW5zaWduZWQgTiwgdHlwZW5hbWUgVCA9IGRvdWJsZSA+ IGNsYXNzIFgge307Cgl0ZW1wbGF0ZSA8IHVuc2lnbmVkIE4sIHR5cGVuYW1lIFQgPSBkb3VibGUg PiBjbGFzcyBZIHt9OwoKCXRlbXBsYXRlIDwgdW5zaWduZWQgTiwgdHlwZW5hbWUgVCA+CglZIDwg TiAtIDEsIFQgPgoJb3BlcmF0b3IgKiAoWCA8IE4sIFQgPiBjb25zdCAmLCBZIDwgTiwgVCA+IGNv bnN0ICYpIHRocm93ICgpCgl7CgkJcmV0dXJuIFkgPCBOIC0gMSwgVCA+ICgpOwoJfQojaWYgMQoJ dGVtcGxhdGUgPCB1bnNpZ25lZCBOLCB0eXBlbmFtZSBUID4KCVkgPCBOICsgMSwgVCA+CglvcGVy YXRvciAqIChYIDwgTiArIDEsIFQgPiBjb25zdCAmLCBZIDwgTiwgVCA+IGNvbnN0ICYpIHRocm93 ICgpCgl7CgkJcmV0dXJuIFkgPCBOICsgMSwgVCA+ICgpOwoJfQojZWxzZQoJdGVtcGxhdGUgPCB1 bnNpZ25lZCBOLCB0eXBlbmFtZSBUID4KCVkgPCBOLCBUID4KCW9wZXJhdG9yICogKFggPCBOLCBU ID4gY29uc3QgJiwgWSA8IE4gLSAxLCBUID4gY29uc3QgJikgdGhyb3cgKCkKCXsKCQlyZXR1cm4g WSA8IE4sIFQgPiAoKTsKCX0KI2VuZGlmCgoKCXRlbXBsYXRlIFkgPCAxLCBkb3VibGUgPiBvcGVy YXRvciAqIChYIDwgMiwgZG91YmxlID4gY29uc3QgJiwgWSA8IDIsIGRvdWJsZSA+IGNvbnN0ICYp IHRocm93ICgpOwoJdGVtcGxhdGUgWSA8IDIsIGRvdWJsZSA+IG9wZXJhdG9yICogKFggPCAyLCBk b3VibGUgPiBjb25zdCAmLCBZIDwgMSwgZG91YmxlID4gY29uc3QgJikgdGhyb3cgKCk7Cn0KCmlu dAptYWluICgpCnsKCXRyeQoJewoJfQoJY2F0Y2ggKC4uLikKCXsKCX0KCXJldHVybiAwOwp9Cg==
next reply other threads:[~2002-05-23 7:06 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-05-23 0:06 sfking00 [this message] 2002-05-23 6:55 lerdsuwa
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=20020523065655.15107.qmail@sources.redhat.com \ --to=sfking00@hotmail.com \ --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: linkBe 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).