This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR c++/11987: why is it invalid?


Ian Lance Taylor wrote:

> typedef void (*HandlerFunction)();
> typedef HandlerFunction (*SetHandlerFunction)(HandlerFunction);
> 
> template <SetHandlerFunction set_function>
> class HandlerStack {
> public:
>   static void defaultHandler();
> };
> 
> typedef HandlerStack<std::set_terminate> Terminate;
> 
> template<> void Terminate::defaultHandler() {}
> ==================================================
> 
> This test case uses a typedef when defining the function
> defaultHandler.  Is this code legal?  If yes, then what is the
> difference between this and the example above?

Yes, that's valid.

> // PR c++/19244
> 
> typedef struct { void f(); } f;
> void f::f() { }
> ==================================================

So's, that.

IIRC, it's specifically the situation where the typedef is nested in
another class.  Now, it would sure be useful if I had the standardese to
justify that, wouldn't it? :-)  I'll see if I can find it.

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]