rfg@MCC.COM (Ron Guilmette) (04/12/89)
The following piece of code, if compiled with g++ 1.34.1 using the
-fall-virtual option, will cause the compiler to segfault.
The problem seems to have been that cplus-typeck.c contained an
incorrect test for "constructorness". A trivial patch is provided
below. This patch may fix some other related bugs as well.
// Options: -fall-virtual
class base {
public:
void operator -> () (int, int, ...);
};
class derived : public base {
public:
derived ();
};
void* p;
int test ()
{
p = (void*) &derived::derived; // SEGFAULT
}
*** ../cplus-typeck.c Wed Mar 15 11:26:44 1989
--- cplus-typeck.c Mon Mar 27 18:30:50 1989
***************
*** 3471,3475 ****
&& (TREE_HAS_METHOD_CALL_OVERLOADED (DECL_CONTEXT (t))
|| TREE_NEEDS_WRAPPER (DECL_CONTEXT (t)))
! && ! TREE_IS_CONSTRUCTOR (TREE_TYPE (t))))
{
offset = copy_node (DECL_VINDEX (t));
--- 3471,3475 ----
&& (TREE_HAS_METHOD_CALL_OVERLOADED (DECL_CONTEXT (t))
|| TREE_NEEDS_WRAPPER (DECL_CONTEXT (t)))
! && ! TREE_IS_CONSTRUCTOR (t)))
{
offset = copy_node (DECL_VINDEX (t));