This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: g++ bug w/ exception specs
- From: Gabriel Dos Reis <gdr at codesourcery dot com>
- To: Benjamin Kosnik <bkoz at redhat dot com>
- Cc: gcc-bugs at gcc dot gnu dot org
- Date: 18 Feb 2002 12:00:28 +0100
- Subject: Re: g++ bug w/ exception specs
- Organization: CodeSourcery, LLC
- References: <200202180849.g1I8nkU13879@fillmore.constant.com>
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