[gnu.g++.bug] Function linkage name depends on enum parameter seen as C or C++

brad%bnrmtl.UUCP@LARRY.MCRCIM.MCGILL.EDU (Brad Fowlow) (01/09/90)

I'm not sure this is a bug but it hurts when it bites.

If an enum is seen under extern "C" it gets a different name
for function-parameter encoding than if the same enum is seen
by C++ directly.   

The following session demonstrates.  Note that the linkage name for 
'check' in the nm output at the bottom varies for a.cc and b.cc.

Script started on Mon Jan  8 15:46:14 1990
tsingtao.brad 1 % 
tsingtao.brad 1 % cat a.cc 
/*
 *  Version A - C linkage for enum
 */
extern "C" {
typedef enum { Stop, Go } E;
}

void check( E );

void test()
{
   check( Stop );
}

tsingtao.brad 2 % cat b.cc

/*
 *  Version B - C++ linkage for enum
 */

typedef enum { Stop, Go } E;

void check( E );

void test()
{
   check( Stop );
}

tsingtao.brad 3 % g++ -v -c a.cc b.cc
gcc version 1.36.1 (based on GCC 1.36)
 /usr/local/lib/gcc-cpp -+ -v -undef -D__GNUC__ -D__GNUG__ -D__cplusplus -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 a.cc /usr/tmp/cca11478.cpp
GNU CPP version 1.36
 /usr/local/lib/gcc-cc1plus /usr/tmp/cca11478.cpp -quiet -dumpbase a.cc -version -o /usr/tmp/cca11478.s
GNU C++ version 1.36.1 (based on GCC 1.36) (68k, MIT syntax) compiled by GNU C version 1.36.
default target switches: -m68020 -mc68020 -m68881 -mbitfield
 /usr/local/lib/gcc-as -mc68020 -o a.o /usr/tmp/cca11478.s
 /usr/local/lib/gcc-cpp -+ -v -undef -D__GNUC__ -D__GNUG__ -D__cplusplus -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 b.cc /usr/tmp/cca11478.cpp
GNU CPP version 1.36
 /usr/local/lib/gcc-cc1plus /usr/tmp/cca11478.cpp -quiet -dumpbase b.cc -version -o /usr/tmp/cca11478.s
GNU C++ version 1.36.1 (based on GCC 1.36) (68k, MIT syntax) compiled by GNU C version 1.36.
default target switches: -m68020 -mc68020 -m68881 -mbitfield
 /usr/local/lib/gcc-as -mc68020 -o b.o /usr/tmp/cca11478.s
tsingtao.brad 4 % nm a.o b.o

a.o:
         U _check__F3$_0
00000000 T _test__Fv
00000000 t gcc_compiled.

b.o:
         U _check__F1E
00000000 T _test__Fv
00000000 t gcc_compiled.
tsingtao.brad 5 % exit
tsingtao.brad 6 % 
script done on Mon Jan  8 15:47:58 1990

.................................................................
Brad Fowlow  bnrmtl!brad@larry.mcrcim.mcgill.edu
             .....................................................
             BNR              
	     3 Place du Commerce, Verdun, Quebec, Canada  H3E 1H6 

tiemann@AI.MIT.EDU (Micheal Tiemann) (01/10/90)

Fixed it.

Michael