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]

[Bug c++/2204] G++ doesn't check (member) function parameter for abstract-ness.


------- 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


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