home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!uvaarpa!murdoch!virginia.edu!gs4t
- From: gs4t@virginia.edu (Gnanasekaran Swaminathan)
- Subject: Re: classes referenced each in their declaration
- Message-ID: <1992Jul24.225524.15961@murdoch.acc.Virginia.EDU>
- Sender: usenet@murdoch.acc.Virginia.EDU
- Reply-To: gs4t@virginia.edu (Gnanasekaran Swaminathan)
- Organization: University of Virginia
- References: <1992Jul23.003724.13021@virginia.edu> <712032673snx@trmphrst.demon.co.uk>
- Date: Fri, 24 Jul 1992 22:55:24 GMT
- Lines: 24
-
- nikki@trmphrst.demon.co.uk (Nikki Locke) writes:
- |> gs4t@virginia.edu (Gnanasekaran Swaminathan) writes:
- |> Thanks for catching the bug. The following is tested
- |> in GNU C++ and it works.
- |>
- |> class Y;
- |>
- |> class X {
- |> Y& y;
- |> public:
- |> X(const Y& y1): y(y1) {}
- |> };
- |Is it permissible to assign a reference to const to a reference to non-
- |const in GNU C++ ?
- |
- |I don't think it should be !
-
- You are right. It is a bug in the GNU C++ compiler.
- GNU C++ didn't catch it.
-
- You can either change the copy constructor to be X(Y& y1): y(y1) {}
- or define the member y to be const Y& y; to correct the program
-
- -Sekar
-