Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!hplabs!hpl-opus!hpnmdla!hpmwtd!jeffa
From: jeffa@hpmwtd.HP.COM (Jeff Aguilera)
Newsgroups: comp.lang.c++
Subject: Re: Automatic variables of type pointer to function?
Message-ID: <1520001@hpmwjaa.HP.COM>
Date: 18 Aug 89 23:46:50 GMT
References: <1117@isaak.UUCP>
Organization: HP Microwave Tech. - Santa Rosa, Ca.
Lines: 34

> 
> Look at the following:
> 
> 
>     int func() { return 0; }
> 
>     typedef int (*PFI)();
> 
>     int (*global_explicit)()    = &func;
>     PFI global_typedef          = &func;
> 
>     main()
>     {
> 	static PFI static_typedef       = &func;
> 	static int (*static_explicit)() = &func;
> 
> 	PFI auto_typedef                = &func;
> 	int (*auto_explicit)()          = &func;    // error
>     }
> 
> 
> Although all of the above declarations with initializations seem to
> be valid, both AT&T cfront 1.2 and g++ 1.35.0 complain about the
> last declaration:
> 
>     cfront: error: auto_explicit is undefined
>     g++: `auto_explicit' was not declared
> 
> What's wrong about the above code? What am I missing?
> Or are the compliers the ones to blame?
> Jochen Schwarze, ISA GmbH, Stuttgart, West Germany

Works fine on my HP/350 using AT&T C++ 2.0.  The regular HP-UX cc compiler
complains about "& before array or function".