HDTenEightyP/NetNews huggingface dataset:
From: olafh@berthold.DE (Olaf Heimburger)
Subject: G++ 2.3.3 and template functions doesn't compile
Reply-To: oheimburger@berthold.de
Organization: GNUs Not Usenet
Distribution: gnu
Date: Thu, 7 Jan 1993 09:28:53 GMT

Unfortunately, I had no chance to follow the discussion on this topic,
because I was off for three weeks and most of the postings in
gnu.g++.bug were expired.

Environment: SPARCstation 1, SunOS 4.1.1, gcc-2.3.3, binutils-2.0, libg++-2.3

I've just installed gcc 2.3.3 and tried a simple test program (see
below).  It compiled well but the assembler complained with an
``error: redefinition of symbol "_Max".''

Here is the output of the compiler call:

% g++ -v test.C
Reading specs from /usr/gnu/new/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/specs
gcc version 2.3.3
 /usr/gnu/new/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix test.C /usr/tmp/cca11442.i
GNU CPP version 2.3.3 (sparc)
 /usr/gnu/new/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/cc1plus /usr/tmp/cca11442.i -quiet -dumpbase test.cc -version -o /usr/tmp/cca11442.s
GNU C++ version 2.3.3 (sparc) compiled by GNU C version 2.3.3.
 as -o /usr/tmp/cca114421.o /usr/tmp/cca11442.s
as: "/usr/tmp/cca11442.s", line 101: error: redefinition of symbol "_Max"
/usr/gnu/new/bin/gcc: /usr/tmp/cca114421.o: No such file or directory

And here is the test program:

#include <iostream.h>

template <class T>
T Max (T a, T b) {
    return (a < b) ? b : a;
}

main () {
    int a = 10, b = 9;
    float c = 100., d = 200.;
    cout << Max (a, b) << endl;
    cout << Max (c, d) << endl;
    return 0;
}

Regards,
--olaf

* Olaf Heimburger, H. Berthold AG, Software Development, Berlin (Germany)
* ...!unido!berthold!olafh <oheimburger@berthold.de> <olafh@berthold.de>
* VOICE: +49 30 7 79 54 64                             FAX: +49 30 7 79 55 05

Newsgroups: gnu.g++.bug
From: gml4410@ggr.co.UK (Lack Mr G M)
Subject: bug compiling libg++ on SG Indigo
Organization: GNUs Not Usenet
Distribution: gnu
Date: Tue, 5 Jan 1993 17:35:11 GMT

     I  have  just  built  libg++-2.3 on an SG Indigo (Irix 4.0.1) using
gcc-2.3.3 (which included  a  "make  install-fixincludes"  during  *its*
installation).  I received the following messages:

In file included from /usr/local/lib/gcc-lib/mips-sgi-irix4/2.3.3/include/syslimits.h:6, from /usr/local/lib/gcc-lib/mips-sgi-irix4/2.3.3/include/limits.h:11, from Integer.cc:36:
/usr/include/limits.h:100: warning: `DBL_MAX' redefined
/usr/local/lib/gcc-lib/mips-sgi-irix4/2.3.3/include/float.h:63: warning: this is the location of the previous definition
/usr/include/limits.h:101: warning: `DBL_MIN' redefined
/usr/local/lib/gcc-lib/mips-sgi-irix4/2.3.3/include/float.h:54: warning: this is the location of the previous definition
/usr/include/limits.h:105: warning: `FLT_MAX' redefined
/usr/local/lib/gcc-lib/mips-sgi-irix4/2.3.3/include/float.h:35: warning: this is the location of the previous definition

     I  know  they are only warnings, but the 2 values involved for each
constant differ in the final digit, and I don't *think* there should  be
conflicts  (I  don't  get  this  when I build on a Sparcstation at SunOS
4.1.1). 



-------------------------- Gordon Lack ----------------------------------
The contents of this message *may* reflect my personal opinion.  They are
*not* intended to reflect those of my employer, or anyone else.

Newsgroups: gnu.g++.bug
From: jimc@pic.ucla.edu
Subject: g++ internal compiler error 180
Organization: GNUs Not Usenet
Distribution: gnu
Date: Thu, 7 Jan 1993 03:15:31 GMT

Gnu g++ v2.3.3 for Sparc-SunOS-4.1.1

When a pointer-to-function (not member function) was initialized with
a template function name, the compiler got an internal error 180.

James F. Carter        (213) 825-2897
UCLA-Mathnet;  6221 MSA; 405 Hilgard Ave.; Los Angeles, CA, USA  90024-1555
Internet: jimc@math.ucla.edu            BITNET: jimc%math.ucla.edu@INTERBIT
UUCP:...!{ucsd,ames,ncar,gatech,purdue,rutgers,decvax,uunet}!math.ucla.edu!jimc


-------- Source file

//  bug18.C -- Internal compiler error 180

// g++ v2.3.3 for Sparc-SunOS-4.1.1
// Command line: g++ bug18.C

// bug18.C: In function `int  main ()':
// bug18.C:61: Internal compiler error 180.
// bug18.C:61: Please report this to `bug-g++@prep.ai.mit.edu'.


#include <stdlib.h>
#include <iostream.h>

template<class T>
class data {
    int siz;
    T* stuff;
  public:
    data(int n) : siz(n), stuff(new T[n]) { }
    ~data()
	{ delete stuff; }
    int dim() const
	{ return siz; }
    const T& operator [] (int i) const
	{ return stuff[i]; }
    T& operator [] (int i)
	{ return stuff[i]; }
    static int compare(const T* a, const T* b)
	{ return (int)(*a - *b); }	//Nasty surprise if T=double
    friend ostream& operator << (ostream& f, const data<T>& d);
    void sortme()
	{ qsort(stuff, dim(), sizeof(T), compare); }
//kab.C:26: warning: contravariance violation for method types ignored
};

template <class T> ostream& operator << (ostream& f, const data<T>& d) {
    for (int i = 0; i < d.dim(); ++i)
	f << d[i] << ' ';
    return f;
}
	
template<class T>
int compare(T* a, T* b){ return *a - *b; }

template<class T>
void sort( data<T>d, int (*compare)(T*,T*) )
{ 
     qsort(&(d[0]), d.dim(), sizeof(T), compare); 
}

main(){
	data<int> d(5);
	for (int i = 0; i < d.dim(); ++i)
	    d[i] = d.dim() - i;
	cout << "Before\t" << d << '\n';
//	d.sortme();	// Works

//	sort(d, compare);
//		 type unification failed for function template `sort'
//		(probably ought to be able to figure this one out)

	int (*cptr)(int*,int*) = compare;	//Internal compiler err 180
	sort (d, cptr);

	cout << "After\t" << d << '\n';
}


Newsgroups: gnu.g++.bug
From: dgreen@sti.com (Dan R. Greening)
Subject: G++ 2.3.3 Scoping Does Not Correctly Hide Typedef.
Organization: Software Transformation, Inc.
Distribution: gnu
Date: Thu, 7 Jan 1993 03:54:54 GMT

There is a bug, I believe, in G++ 2.3.3.  Compiling this:

    typedef int fixed;
    class ios {
      public:
	enum { fixed = 010000 };
	enum { floatfield = fixed };
      };

...results in this:

    bug.cc:6: warning: name `int' could be type or expression; compiler assuming type
    bug.cc:6: parse error before `;'

I believe this is a bug, because the declaration of the constant "fixed"
within ios should hide the typedef declaration.  I ran into this problem
when trying to use libg++ 2.3 streams in a program which declared "fixed"
as a type.  Of course, using

	enum { floatfield = ios::fixed };

cures the problem, but editing the libg++ include files is not something
you want to require measly users to do!

Regards,
-- 
____
\  /Dan Greening    Software Transformation   1601 Saratoga-Sunnyvale Rd, #100
 \/dgreen@sti.com   (408) 973-8081 x313       Cupertino, CA 95014

Newsgroups: gnu.g++.bug
From: klamer@mi.eltn.utwente.NL (Klamer Schutte)
Subject: 2.3.3: Illegal code on sparc
Organization: GNUs Not Usenet
Distribution: gnu
Date: Mon, 11 Jan 1993 15:17:40 GMT

The following code gives wrong results (Illegal instruction) on a sparc.
The error is that a 'function entry trampoline' is put on the stack when 
calling a varargs function. When the function is called later, this
'function entry trampoline' does not exist any more, resulting in a bug.

The same program runs OK as a ANSI C program using gcc and (Sun) acc, and
as C++ program using Sun C++ 2.1 and g++ 2.2.1.

----------------------- va3.c --------------------------
#include        <stdio.h>
#include        <stdarg.h>

typedef int     (*FN)(int,int);
FN      fn;

void
va_fn(int a, ...)
{
        va_list args;

        va_start(args, a);

        fn = va_arg(args, FN);

        va_end(args);
}

void
call_va_fn()
{
        extern void     aap(int a, int b);

        va_fn(0,aap);
}

main()
{
        call_va_fn();
        printf("In main\n");
        fn(0,1);
}

void
aap(int a, int b)
{
        printf("In aap\n");
}
-------------------- EOF ------------------
0 klamer@mi7 14:16 172> g++ -v va3.c
Reading specs from /usr/local/lib/gcc-lib/sun4/2.3.3/specs
gcc version 2.3.3
 /usr/local/lib/gcc-lib/sun4/2.3.3/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix va3.c /tmp/cca03752.i
GNU CPP version 2.3.3 (sparc)
 /usr/local/lib/gcc-lib/sun4/2.3.3/cc1plus /tmp/cca03752.i -quiet -dumpbase va3.cc -version -o /tmp/cca03752.s
GNU C++ version 2.3.3 (sparc) compiled by GNU C version 2.3.3.
 as -o /tmp/cca037521.o /tmp/cca03752.s
 /usr/local/lib/gcc-lib/sun4/2.3.3/ld -e start -dc -dp /lib/crt0.o -L/usr/local/lib/gcc-lib/sun4/2.3.3 -L/usr/local/lib /tmp/cca037521.o -lg++ -lgcc -lc -lgcc
0 klamer@mi7 14:17 173> a.out
In main
Illegal instruction

Klamer


Klamer Schutte			Tel: +31-53-892778	Fax: +31-53-340045
Faculty of electrical engineering -- University of Twente, The Netherlands
preferred: klamer@mi.el.utwente.nl     SMTP: klamer@utelmi01.el.utwente.nl


Newsgroups: gnu.g++.bug
From: stravers@muresh.et.tudelft.nl (Paul Stravers)
Subject: conversion method never called
Reply-To: Paul Stravers <stravers@donau.et.tudelft.nl>
Organization: GNUs Not Usenet
Distribution: gnu
Date: Thu, 7 Jan 1993 19:08:33 GMT

This reports a bug in g++ version 2.3.1 and 2.3.3.

If you specify a conversion method that converts a class object to A REFERENCE
to something else, then g++ never generates code that calls this conversion
method. The following example defines a class "test" that has a conversion
operator int&() that is never called, even if we specify a typecast from "test"
to "int&" (as is done in the second line of main()):
------------------------------------------------------------------------------
#include <stdio.h>

class test
{
   double d;
   int    i;
public:
   test(double dd,int ii) {d=dd; i=ii;} // constructor
   operator int&()        {return i;} // define a conversion from test to int&
   int& geti()            {return i;} // same thing, but different
};

main()
{
   test t(3.14, 5);  // Create an object t of class "test"
   int x = (int&)t;  // This should call operator int&() but it does not ...
   int y = t.geti(); // x and y should both be 5 ...
   printf("%d\n%d\n", x, y);
}
------------------------------------------------------------------------------
The output (on a sparc station) of this program is:

    % gcc test.C
    % a.out
    1074339512
    5

The same problem appears on a HP snake. The problem disappears if we specify
any other conversion method for the class test that is not a conversion to a
reference to something. For instance, "operator int ()" works fine, but
"operator int& ()" does not.

Paul Stravers
-- 
Delft University of Technology      |  email stravers@donau.et.tudelft.nl
Faculty of Electrical Engineering   |  fax +31 15 786190
Mekelweg 4                          |  ph. +31 15 786280
2628 CD   Delft                     |
the Netherlands                     |

Newsgroups: gnu.g++.bug
From: bashford@scripps.edu
Subject: Another g++-2.3.3 internal error building libg++-2.3
Organization: GNUs Not Usenet
Distribution: gnu
Date: Mon, 11 Jan 1993 13:29:03 GMT

I have built gcc on the dec alpha using "configure --target=alpha-dec-osf1"
The compiler built and compiled itself.  It did not pass the stage3
stage2 comparison test, but this seems to be because the native assembler
puts strings in the object files giving the name of the /tmp/cc*.s files
which, of course, differ each time.

My machine identifies itself this way when I log in:
  DEC OSF/1 T1.2-1  (Rev. 12); Tue Jan 05 15:04:54 PST 1993
  DEC OSF/1 T1.2-1 Worksystem Software (Rev. 11)
and the arch command returns "alpha".

When I try to build libg++-2.3, I get an internal compiler error
on line 34 of libg++/src/AllocRing.cc.

I can reproduce the problem with the following smaller source file:
% cat bug2.cc 
class AllocRing 
{ 
 
  struct AllocQNode 
  { 
    void*  ptr; 
    int    sz; 
  }; 
 
  AllocQNode* nodes; 
  int         n; 
  int         current; 
 
  int         find(void* p); 
 
public: 
 
              AllocRing(int max); 
             ~AllocRing(); 
 
  void*       alloc(int size); 
  int         contains(void* ptr); 
  void        clear(); 
  void        free(void* p); 
}; 
 
 
AllocRing::AllocRing(int max) 
  :n(max), current(0), nodes(new AllocQNode[max]) 
{ 
  for (int i = 0; i < n; ++i) 
  { 
    nodes[i].ptr = 0; 
    nodes[i].sz = 0; 
  } 
} 

EOF
And here is the crash:

% gcc -v -O -c bug2.cc 
Reading specs from /usr/local/lib/gcc-lib/alpha-dec-osf1/2.3.3/specs 
gcc version 2.3.3 
 /usr/local/lib/gcc-lib/alpha-dec-osf1/2.3.3/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dunix -D__osf__ -D__alpha -D__alpha__ -D_LONGLONG -DSYSTYPE_BSD -D_SYSTYPE_BSD -D__unix__ -D__osf__ -D__alpha -D__alpha__ -D___LONGLONG__ -D__SYSTYPE_BSD__ -D___SYSTYPE_BSD__ -D__unix -D__osf__ -D__alpha -D__alpha__ -D___LONGLONG -D__SYSTYPE_BSD -D___SYSTYPE_BSD -D__OPTIMIZE__ -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS bug2.cc /usr/local/lib/tmp/cc008760.i 
GNU CPP version 2.3.3 
 /usr/local/lib/gcc-lib/alpha-dec-osf1/2.3.3/cc1plus /usr/local/lib/tmp/cc008760.i -quiet -dumpbase bug2.cc -O -version -o /usr/local/lib/tmp/cc008760.s 
GNU C++ version 2.3.3 compiled by GNU C version 2.3.3. 
bug2.cc: In method `AllocRing::AllocRing (int)': 
bug2.cc:36: Internal compiler error. 
bug2.cc:36: Please report this to `bug-g++@prep.ai.mit.edu'. 
% 

If I leave out the -O flag, it does not crash.

Newsgroups: gnu.g++.bug
From: rwk@integra.UUCP (Richard W. Kreutzer)
Subject: A bug in virtual functions.
Organization: GNUs Not Usenet
Distribution: gnu
Date: Mon, 4 Jan 1993 22:52:47 GMT

I believe the following exhibits a bug in g++:

================================== bug.cc =====================================
#include <iostream.h>

class Type {
public:
  virtual void Print() = 0;
  };

class Port : public Type {
public:
  short flagBits;
#ifndef BUG
  virtual void Print()  = 0;
#endif
  };

class PortOut : public ostream, public Port {
public:
  PortOut(int fd) {init(new filebuf(fd));}
  PortOut &operator<<(Type *p) {p->Print(); return *this;}
  virtual void Print() {cout << "PortOut fn" << endl;}
  };

PortOut& operator<<(PortOut& p, const Type &bt);

main() {
  PortOut po(1);
  Type *t = &po;
  po << t;
  }
=================================================================================


Compiled with:

   g++ -g bug.cc -o bug
   ./bug

works correctly.

Compiled with:

   g++ -DBUG -g bug.cc -o bug
   ./bug

dumps core.

If this is not a bug, could you let me know what I am doing wrong.

Thanks,
Dick

Newsgroups: gnu.g++.bug
From: tmb@idiap.CH (Thomas M. Breuel)
Subject: internal compiler error after failed type unification
Reply-To: tmb@idiap.ch
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 6 Jan 1993 21:35:36 GMT

[I don't want to pretend this code makes sense, bug GNU C++ shouldn't
crash on it.]

cd /fs/vision01/tmb/src/rec-character/
gcc -c -v foo.cc
Reading specs from /sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.2/specs
gcc version 2.3.2
 /sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.2/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix foo.cc /local/tmp/cca20605.i
GNU CPP version 2.3.2 (sparc)
 /sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.2/cc1plus /local/tmp/cca20605.i -quiet -dumpbase foo.cc -version -o /local/tmp/cca20605.s
GNU C++ version 2.3.2 (sparc) compiled by GNU C version 2.3.2.
foo.cc: In function `void  restore (struct _iobuf*, struct Stk<Stk<int>>&)':
foo.cc:17: type unification failed for function template `restore'
foo.cc:21: Internal compiler error.
foo.cc:21: Please report this to `bug-g++@prep.ai.mit.edu'.

Compilation exited abnormally with code 1 at Wed Jan  6 20:33:48

================================================================
extern "C" {
#include <stdio.h>
}

template <class T>
struct Stk {
	T t[100];
	int fill;
	T &operator()(int i) {return t[i];}
};

template <class T>
void restore(FILE *stream,Stk<T> &stack) {
	int l;
	fread(&l,sizeof l,1,stream);
	stack.fill = l;
	for(int i=0;i<l;i++) restore(stream,stack(i));
}

template <class T>
void restore(FILE *stream,Stk< Stk<T> > &stack) {
	int l;
	fread(&l,sizeof l,1,stream);
	stack.fill = l;
	for(int i=0;i<l;i++) restore(stream,stack(i));
}

void restore(FILE *stream,int &x) {
	fread(&x,sizeof x,1,stream);
}

main() {
	Stk< Stk<int> > foo;
	restore(stdin,foo);
}
================================================================

Newsgroups: gnu.g++.bug
From: tim@uk.ac.cf.astro.hecate (Tim Barnett)
Subject: g++-include/stdio.h header file under SCO UNIX (again)
Reply-To: barnett@cardiff.ac.uk
Organization: GNUs Not Usenet
Distribution: gnu
Date: Thu, 7 Jan 1993 15:04:58 GMT

Mea culpa.
I forgot that there is no symbol SCO, so the #if defined(SCO) that I said is
wrong - sorry - but the idea of #undef'ing remove is still sound ...
Sorry
Tim

Newsgroups: gnu.g++.bug
From: jbg@qualcomm.com (Jeff Gehlhaar)
Subject: Core dump now internal error
Organization: GNUs Not Usenet
Distribution: gnu
Date: Mon, 4 Jan 1993 02:19:11 GMT

// This program used to cause G++ to dump core.  It now causes an internal
// compiler error.

// All of this, both code and options, seem to be necessary to tickle
// the bug.  Don't ask _me_ why; I don't see how they are related....

// The result of ``g++ -v -c -O -g -funroll-loops bug006.cc'' is attached below.

// -- Greg

#include <iostream.h>
#define SHOW(x)    do { cout << x << endl; } while (0)

class List
{
public:
        List(void) { list = 0; }
        class List *list;
};

class Class
{
public:
        Class(char *param);
        List queue;
};

Class::Class(char *param)
{
        SHOW("Display some text");
}

/* Compiler output follows:
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/specs
gcc version 2.3.3
 /usr/local/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/cpp -lang-c++ -v -undef
-D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__
-D__sun__ -D__unix__ -D__sparc -D__sun -D__unix -D__OPTIMIZE__ -g bug006.cc
/usr/tmp/cca29841.i
GNU CPP version 2.3.3 (sparc)
 /usr/local/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/cc1plus
/usr/tmp/cca29841.i -quiet -dumpbase bug006.cc -g -O -version
-funroll-loops -o /usr/tmp/cca29841.s
GNU C++ version 2.3.3 (sparc) compiled by CC.
bug006.cc: In method `Class::Class (char *)':
bug006.cc:31: Internal compiler error.
bug006.cc:31: Please report this to `bug-g++@prep.ai.mit.edu'.
Compiler output above */


======================================================
Jeff Gehlhaar           Qualcomm Inc,  
jbg@qualcomm.com        San Diego, CA, USA
(619) 597-5241          "The Elegant Solution...."
======================================================


Newsgroups: gnu.g++.bug
From: dave@hiauly1.hia.nrc.ca (John David Anglin)
Subject: math.g generated by fixincludes on hp730 8.07
Organization: GNUs Not Usenet
Distribution: gnu
Date: Fri, 8 Jan 1993 22:36:53 GMT

I found the following changes to the math.h generated by fixincludes on
my hp730 running hpux 8.07 necessary to build libg++ 2.3:

# diff -c math.h.orig math.h
*** math.h.orig	Thu Jan  7 15:23:43 1993
--- math.h	Wed Dec 16 01:08:08 1992
***************
*** 30,43 ****
       extern double log10(double);
       extern double modf(double, double *);
       extern double pow(double, double);
- #    ifdef __cplusplus
-      }
-      inline double pow(double __d,int __expon) {
- 	 return pow(__d,(double)__expon);
-      }
-      extern "C" {
- #else
- #    endif
       extern double sqrt(double);
       extern double ceil(double);
       extern double fabs(double);
--- 30,35 ----
***************
*** 182,188 ****
  }
  inline int sqr(int x) {return(x*x);}  /* For AT&T compatibility */
  inline double sqr(double x) {return(x*x);}
! 
  
  #endif
  
--- 174,181 ----
  }
  inline int sqr(int x) {return(x*x);}  /* For AT&T compatibility */
  inline double sqr(double x) {return(x*x);}
! #include <float.h>
! inline int isinf(double x) { return x > DBL_MAX || x < -DBL_MAX; }
  
  #endif
  
Dave Anglin
National Research Council of Canada

Newsgroups: gnu.g++.bug
From: nk@lns598.tn.cornell.edu
Subject: compiler errir 252 from 2.3.3 on mips-dec-ultrix
Organization: GNUs Not Usenet
Distribution: gnu
Date: Fri, 8 Jan 1993 15:46:47 GMT


Newsgroups: gnu.g++.bug
From: tom@izfcs.izf.tno.nl (Tom Vijlbrief)
Subject: inline friends misbehave in 2.3.3
Organization: TNO Institute for Perception
Distribution: gnu
Date: Tue, 5 Jan 1993 16:27:59 GMT

Inline friends cause multiple defineds in g++2.3.3

2.2.2 worked ok......

Note:

ld: /usr/tmp/cca007182.o: _showit__Fv: multiply defined

in the following script



Script started on Tue Jan  5 17:24:32 1993
bash$ cat bug.cc

#include <stdio.h>

class demo {
public:
   friend void showit() { fprintf(stderr, "show it\n"); }
};

main()
{
  demo *d= new demo();

  showit();
}

bash$ cat bug2.cc

#include <stdio.h>

class demo {
public:
   friend void showit() { fprintf(stderr, "show it\n"); }
};

main2()
{
  demo *d= new demo();

  showit();
}
bash$ g++ bug.cc bug2.cc -v
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/specs
gcc version 2.3.3
 /usr/local/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix bug.cc /usr/tmp/cca00718.i
GNU CPP version 2.3.3 (sparc)
 /usr/local/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/cc1plus /usr/tmp/cca00718.i -quiet -dumpbase bug.cc -version -o /usr/tmp/cca00718.s
GNU C++ version 2.3.3 (sparc) compiled by GNU C version 2.3.3.
 as -o /usr/tmp/cca007181.o /usr/tmp/cca00718.s
 /usr/local/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix bug2.cc /usr/tmp/cca00718.i
GNU CPP version 2.3.3 (sparc)
 /usr/local/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/cc1plus /usr/tmp/cca00718.i -quiet -dumpbase bug2.cc -version -o /usr/tmp/cca00718.s
GNU C++ version 2.3.3 (sparc) compiled by GNU C version 2.3.3.
bug2.cc: In function `int  main2 ()':
bug2.cc:13: warning: control reaches end of non-void function
 as -o /usr/tmp/cca007182.o /usr/tmp/cca00718.s
 /usr/local/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/ld -e start -dc -dp /lib/crt0.o -L/usr/local/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3 -L/usr/local/lib /usr/tmp/cca007181.o /usr/tmp/cca007182.o -lg++ -lgcc -lc -lgcc
ld: /usr/tmp/cca007182.o: _showit__Fv: multiply defined
collect: /usr/bin/ld returned 2 exit status
bash$ exit

script done on Tue Jan  5 17:25:16 1993

Newsgroups: gnu.g++.bug