This is the mail archive of the gcc-bugs@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: g++ bug w/ exception specs


Benjamin Kosnik <bkoz@redhat.com> writes:

| >From e000006.cpp in Bench++:
| 
| class exception_6 
| {
| public:
|   bool flag;		// controls return or raise exception
|   void proc_1(void) throw(exception_6);	   // either returns or raises exception
|   void proc_2(void) throw(exception_6);	   // calls proc_1
|   void proc_3(void) throw(exception_6);	   // calls proc_2
|   void proc_4(void) throw(exception_6);	   // calls proc_3
| };
| 
| 
| gives:
| 
| e000006.cpp:17: invalid use of undefined type `class exception_6'

Hmm, this is a bit tricky: on a first take one might think that
exception specification should be handled in the same way as function 
paramater types.  However 15.4/1 says:

   [...] A type denoted in an exception-specification shall not denote
   an incomplete type. A type denoted in an exception-specification
   shall not denote a pointer or reference to an incomplete type,
   other than void*, const void*, volatile void*, or const volatile
   void*. 

which is a radical departure from the way function parameter types are
handled.  Moreover:

9.2/2:
   A class is considered a completely-defined object type (3.9) (or
   complete type) at the closing } of the class-specifier. Within the
   class member-specification, the class is regarded as complete
   within function bodies, default arguments and constructor
   ctor-initializers (including such things in nested
   classes). Other-wise it is regarded as incomplete within its own
   class member-specification.

The above specifically ignores exception-specifications and the
"otherwise" part seems to cover g++'s current behaviour.  Thoughts?

-- Gaby
CodeSourcery, LLC                       http://www.codesourcery.com

  


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