egcs template problem (fwd)

Stephen J. Gowdy gowdy@mh1.lbl.gov
Tue Mar 2 00:29:00 GMT 1999


Hi All,
	I posted a message last Friday about this bug. Here is a more
concise report from one of my collaborators. He says this does work with
gcc 2.8.1.

							regards,

							Stephen.

--
 /------------------------------+-=-=-=-=-+-------------------------\
|Stephen J. Gowdy               |A4000/040| Mail Stop 50A-2160, LBL, |
| http://www.ph.ed.ac.uk/~gowdy/ | 1GB   HD| 1 Cyclotron Rd, Berkeley,|
|                               |20MB  RAM| CA 94720, USA            |
|InterNet: SGowdy@lbl.gov       |3.4xCDROM| Tel: +1 510 495 2796     |
 \------------------------------+-=-=-=-=-+-------------------------/

---------- Forwarded message ----------
Date: 01 Mar 1999 23:21:27 -0800
From: alexander romosan <romosan@mh1.lbl.gov>
To: SGowdy@lbl.gov
Cc: "David R. Quarrie" <DRQuarrie@lbl.gov>,
    Ed Frank <efrank@upenn5.hep.upenn.edu>,
    Bob Jacobsen <Bob_Jacobsen@lbl.gov>, SKluth@lbl.gov,
    Paul Raines <raines@SLAC.Stanford.EDU>
Subject: Re: egcs template problem

"Stephen J. Gowdy" <gowdy@mh1.lbl.gov> writes:

> Hi All,
> 	I've attached a test problem which illustrates the trouble I
> mentioned with egcs/objecitivity at the Collabortion meeting. It was Alex
> which pointed it to me first. He also has a test program to show it, but I
> didn't get it from him yet.

the test program is this:

#include <stddef.h>
#include <iostream.h>

//  primary template
template <class T> class A {
public:
  void *f();
  void *operator new(size_t);
};

template <class T>
void *A<T>::operator new(size_t)
{return 0;}


// specialised f method compiles
void *A<int >::f()
{ cout << "we are an integer" << endl; }

// specialised f method compiles
void *A<float >::f()
{ cout << "we are a float" << endl; }

// specialised new operator breaks
void *A<int>::operator new(size_t)
{ cout << "what are we doing?" << endl;
  return 0; }

int main()
{
  A<int>* a = new A<int>;
  a->f();

  A<float> b;
  b.f();

and if i compile it with gcc-2.8.1 it WORKS. 
<snip>
--alex--

-- 
| I believe the moment is at hand when, by a paranoiac and active |
|  advance of the mind, it will be possible (simultaneously with  |
|  automatism and other passive states) to systematize confusion  |
|  and thus to help to discredit completely the world of reality. |



More information about the Gcc-bugs mailing list