Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!UUNET.UU.NET!mcvax!jclark!jjc From: mcvax!jclark!jjc@UUNET.UU.NET (James Clark) Newsgroups: gnu.g++.bug Subject: g++ 1.34.1 gets segmentation violation Message-ID: <8903260816.AA14665@jclark.uucp> Date: 26 Mar 89 08:16:48 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 41 g++ 1.34.1 gets a segmentation violation if one erroneously supplies a return type for a constructor. jclark% cat test.c struct foo { void foo(); }; jclark% g++ -g -v -c test.c g++ version 1.34.1 /usr/local/lib/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ test.c /tmp/cca14546.cpp GNU CPP version 1.34 /usr/local/lib/gcc-c++ /tmp/cca14546.cpp -quiet -dumpbase test.c -g -version -o /tmp/cca14546.s GNU C++ version 1.34.1 (sparc) compiled by GNU C version 1.34. test.c:3: invalid return type given for constructor test.c:3: Segmentation violation Program c++ got fatal signal 11. There's a typo in cplus-decl.c: *** cplus-decl.c.orig Sun Mar 26 07:49:13 1989 --- cplus-decl.c Sun Mar 26 08:08:38 1989 *************** *** 3705,3711 **** && TYPE_MAIN_VARIANT (type) != TYPE_POINTER_TO (ctor_return_type)) { error ("invalid return type given for constructor"); ! type = TYPE_POINTER_TO (ctype); } ctype = NULL_TREE; --- 3705,3712 ---- && TYPE_MAIN_VARIANT (type) != TYPE_POINTER_TO (ctor_return_type)) { error ("invalid return type given for constructor"); ! type = TYPE_POINTER_TO (ctor_return_type); ! explicit_int = -1; } ctype = NULL_TREE;