public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* string literals in struct initializers with C++
@ 2002-10-15 11:44 J.T. Conklin
  2002-10-15 13:04 ` Michael Ritzert
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: J.T. Conklin @ 2002-10-15 11:44 UTC (permalink / raw)
  To: gcc

In the process of moving from the gcc-3_2-branch to the CVS head, I found 
code with string literals in struct initializers no longer compiles using
g++.  I'm not sure whether this is just a tightening of the parser or a 
bug.

The following code:

        struct foo {
                char    x[20];
                int     y;
                int     z;
        };

        struct foo foos[] = {
                { "foo", 0, 2 },
                { "bar", 1, 3 }
        };

Now results in:
        foo.cc:10: error: invalid conversion from `const char*' to `char'
        foo.cc:10: error: invalid conversion from `const char*' to `char'

When it used to compile with older versions of g++.  It continues to
compile with gcc.

        --jtc

-- 
J.T. Conklin

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

end of thread, other threads:[~2002-10-15 21:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-15 11:44 string literals in struct initializers with C++ J.T. Conklin
2002-10-15 13:04 ` Michael Ritzert
2002-10-15 13:10 ` J.T. Conklin
2002-10-15 15:16 ` Mark Mitchell

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).