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]

Re: egcs-980517 bug report


dcb@pncl.co.uk (David C Binderman) writes:

> Hello there,
> 
> I think the following C++ code should not compile
> 
> // this should fail
> 
> union U {
> 	U();
> 	int & ri;
> };

You actually can; from $9.5 of the draft standard:


  A union  can  have  member functions  (including  constructors  and
  destructors), but not virtual functions. 

If you try to declare a method virtual, g++ will give an error.

-- 
Brendan Kehoe                                               brendan@cygnus.com
Cygnus Solutions, Sunnyvale, CA                                +1 408 542 9600

Web page: http://www.zen.org/~brendan/


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