public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* compile error when initializing descendant struct
@ 2008-04-09 23:09 Dave Bender
  2008-04-09 23:42 ` Young, Michael
  2008-04-10  2:42 ` corey taylor
  0 siblings, 2 replies; 6+ messages in thread
From: Dave Bender @ 2008-04-09 23:09 UTC (permalink / raw)
  To: gcc-help

Dear list,
  When I attempt to compile the following code (test2.cpp):


struct A {
  int x;
};

struct B : public A {
  int y;
};

const B b = {1, 2};


g++ gives the following error:

test2.cpp:9: error: scalar object 'b' requires one element in initializer

My goal is to incorporate a large set of structs in a DSO (so that
they reside in the read only section). I don't see why this code
should not compile.

Thanks,
-Dave

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-04-10  2:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-09 23:09 compile error when initializing descendant struct Dave Bender
2008-04-09 23:42 ` Young, Michael
2008-04-10  2:09   ` Dave Bender
2008-04-10  3:18     ` Brian Dessent
2008-04-10  2:42 ` corey taylor
2008-04-10  3:21   ` Dave Bender

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).