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++/15774] Conflicting function decls not diagnosed


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


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