jjc@UUNET.UU.NET (James Clark) (03/26/89)
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;