home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!van-bc!rsoft!agate!usenet.ins.cwru.edu!gatech!bloom-beacon!eru.mt.luth.se!lunic!sunic!kth.se!news.kth.se!RICHARD
- From: RICHARD@NIXON.ttt.kth.se
- Newsgroups: comp.lang.c++
- Subject: Strange error. GCC 2.2.2
- Message-ID: <RICHARD.92Sep6170946@NIXON.ttt.kth.se>
- Date: 6 Sep 92 16:09:46 GMT
- Sender: usenet@kth.se (Usenet)
- Organization: Department of TeleTransmission Theory
- Lines: 56
- Nntp-Posting-Host: nixon.ttt.kth.se
-
- I have the following code:
-
- struct foo
- {
- char *s;
- foo(char *x) { s=x; }
- };
-
- struct bar
- {
- foo * v;
- bar () { v=0; }
- bar (foo * x) { v=x; }
- bar & operator = (bar & x) { v=x.v; return *this; }
- };
-
- struct cookie
- {
- foo * v;
- cookie ( foo * x) { v=x; }
- };
-
- cookie cat(&foo("apabepa"));
-
- struct cake
- {
- bar v;
- cake ( bar & x ) { v=x; }
- };
-
- cake monkey(&foo("haha")); // <---- GCC barfs here
-
- At the place where gcc barfs, it is cc1plus with gives me a fatal signal 11.
-
- It is fixed by spliting that line with:
-
- foo monkey_dummy("haha");
- cake monkey(&monkey_dummy);
-
- Details: note that the argument passed to the cake constructor is a foo *,
- and thus is converted to bar with the constructor bar(foo *).
-
- The definition of cat works like charms.
-
- What I would like to know is if the contruction GCC barfs on is legal (and
- thus, there is a bug in GCC), or if I tried to do something illegal.
-
- I do not have the ARM, so those who have, please tell me.
-
- --
- !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!
- ! Richard Levitte, System manager ! tel: int+46-8-790 64 23 !
- ! Royal Institute of Technology ! fax: int+46-8-791 76 54 !
- ! Department of Teletransmition Theory ! Internet: richard@ttt.kth.se !
- ! S-100 44 Stockholm, Sweden ! !
- !---------------------------------------------------------------------------!
-