This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/2204] G++ doesn't check (member) function parameter for abstract-ness.
- From: "giovannibajo at libero dot it" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Feb 2004 04:37:05 -0000
- Subject: [Bug c++/2204] G++ doesn't check (member) function parameter for abstract-ness.
- References: <20010307052600.2204.gdr@codesourcery.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From giovannibajo at libero dot it 2004-02-09 04:37 -------
The problem is that we currently check for abstractness of parameter types in
gorkparms, which is way too early for the current class. Putting it into
start_function is a stop-gap, but 10.4/3 says that *declarations* are ill-
formed, there is no need for a definition.
I tried another approacch, which is doing the check in finish_struct_1, after
CLASSTYPE_PURE_VIRTUALS has been properly calculated. But this does not cure
testcases like:
---------------------------------
struct X;
struct Y {
void g(X x);
};
struct X : Y {
virtual void xfunc(void) = 0;
};
---------------------------------
which should be rejected as well. Also, abstract_virtual_errors should be
enhanced to go through array types, because the following is accepted:
---------------------------------
struct X {
virtual void xfunc(void) = 0;
};
void g(X x[2]);
---------------------------------
There is some code to properly strip array/pointer types within cp_finish_decl
(strip_array_types is too weak and won't work in the general case, see
g++.dg/other/abstract1.C).
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |giovannibajo at libero dot
| |it
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=2204