[Bug c++/15774] Conflicting function decls not diagnosed

dannysmith at users dot sourceforge dot net gcc-bugzilla@gcc.gnu.org
Mon Jun 28 01:43:00 GMT 2004


------- Additional Comments From dannysmith at users dot sourceforge dot net  2004-06-28 01:42 -------
Yes I did test it and it was wrong, because it appears  C++ front end handles 
attributes of class member functions differently than global functions. 
Attributes of member functions are only honoured when declared within class 
definition,  which makes sense to me.  So for something like this (g++-old-
deja/g++.ext/attrib2.C) my patch would cause an error to be emitted.  Should it?
Should C++ require (as does C) that the subsequent definition also have an 
explicit attribute?

// { dg-do run { target i?86-*-* } }
// Test that stdcall doesn't prevent us from using op delete.
// Contributed by Jason Merrill <jason@cygnus.com>

struct A {
  void operator delete (void *) __attribute__ ((stdcall));
};

void foo()
{
  A* ap = new A;
  delete ap;
}

void  A:: operator delete (void *)  { }

int main()
{
  A* ap = new A;
  delete ap;
}

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15774



More information about the Gcc-bugs mailing list