🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #745

function types

#745
From: Tomas G. Rokicki
Date: Thu, 18 Jan 1990 23:22
32 lines
1123 bytes
The following code:

typedef int *(evalftype)(int, int) ;

class foo {
   int t ;
   evalftype *f ;
public:
   foo(int a) { t = a ; f = 0 ; }
   foo(evalftype *b) { t = 0 ; f = b ; }
} ;

int *bar(int a, int b) {
   int *p = new int ;
   *p = a - b ;
   return p ;
}

foo *baz() {
   return new foo(&bar) ;
}

(which compiles under cfront 1.2) gives me the errors:

bump.cp: In function class foo *baz():
bum.cp:18: type for resolving address of overloaded function must be pointer type
bum.cp:18: bad argument 0 for function `foo::foo (auto int *(*)(int ,int ))' (type was int *(*)(int ,int ))
bum.cp:18: in base initialization for class 'foo'

I'm running 1.36.1 (but am bringing up 1.36.3 . . .)

-tom
Technical Details
Message-ID: <1990Jan18.232249.20248@Neon.Stanford.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!snorkelwacker!bloom-beacon!shelby!neon!rokicki

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!snorkelwacker!bloom-beacon!shelby!neon!rokicki
From: rokicki@Neon.Stanford.EDU (Tomas G. Rokicki)
Newsgroups: gnu.g++.bug
Subject: function types
Message-ID: <1990Jan18.232249.20248@Neon.Stanford.EDU>
Date: 18 Jan 90 23:22:49 GMT
Organization: Computer Science Department, Stanford University
Lines: 32