This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: egcs-980517 bug report
- To: dcb at pncl dot co dot uk (David C Binderman)
- Subject: Re: egcs-980517 bug report
- From: Brendan Kehoe <brendan at cygnus dot com>
- Date: 21 May 1998 14:42:10 -0700
- Cc: egcs-bugs at cygnus dot com
- References: <199805211938.UAA22901.cygnus.egcs.bugs@eiger.pncl.co.uk>
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/