[net.lang.c++] Program that causes cfront to dump core

sher@rochester.ARPA (04/29/86)

From: sher

I was getting a somewhat anomalous error message from c++ so I built
a short test file to find out what I was doing wrong.  Imagine my surprize
when the file caused cfront to dump core.  Imagine my shock when 
I found out that the core that was dumped was in an improper format for
dbx to parse.  This makes life a bit difficult.  I include the file that
dumps the core.  This may not be correct c++.  However dumping core is
not the way to notify me of this fact.

-David Sher
sher@rochester.ARPA
seismo!rochester!sher

#include <stream.h>

overload foo_player;

class foo 
    {
    enum foo_enum { abc , cde } foo_type;
    union
	{
	int foo_int;
	char foo_char;
	} ;
public:
    friend void foo_player ( int i , foo& f );
    friend void foo_player ( char c , foo& f );

    foo ( int i )
	{
	foo_player ( i , *this );
	}
    foo ( char c )
	{
	foo_player ( c , * this );
	}
    
    ~foo ( ) { ; }
    
    };

void
foo_player ( int i , foo& f )
    {
    f.foo_type = abc;
    f.foo_int = i;
    }

void
foo_player ( char c , foo& f )
    {
    f.foo_type = cde;
    f.foo_char = c;
    }