From: jtc@acorntoolworks.com (J.T. Conklin)
To: gcc@gcc.gnu.org
Subject: Re: string literals in struct initializers with C++
Date: Tue, 15 Oct 2002 13:10:00 -0000 [thread overview]
Message-ID: <87fzv7bk4p.fsf@orac.acorntoolworks.com> (raw)
In-Reply-To: <87vg43bn4i.fsf@orac.acorntoolworks.com>
jtc@acorntoolworks.com (J.T. Conklin) writes:
> 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.
FWIW, The same or similar problem appears to effect the following code:
#include <string>
struct bar {
std::string s;
int y;
int z;
};
bar bar_array[] = {
{ "abc", 1, 2 },
{ "def", 2, 4 },
{ "ghi", 3, 6 },
{ "klm", 4, 8 }
};
Which results in:
bar.cc:14: error: conversion from `const char[4]' to non-scalar type
`bar' requested
bar.cc:14: error: conversion from `const char[4]' to non-scalar type
`bar' requested
bar.cc:14: error: conversion from `const char[4]' to non-scalar type
`bar' requested
bar.cc:14: error: conversion from `const char[4]' to non-scalar type
`bar' requested
Unlike the privious example, this one can't be worked around with an
extra layer of {}'s.
And since I neglected to mention it before, this is a g++ from the CVS head,
on QNX 6.2 (the changes I submitted for QNX in August with slight tweaks as
suggested by Zack and as necessary to to adapt to the CVS head.
--jtc
--
J.T. Conklin
next prev parent reply other threads:[~2002-10-15 19:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-15 11:44 J.T. Conklin
2002-10-15 13:04 ` Michael Ritzert
2002-10-15 13:10 ` J.T. Conklin [this message]
2002-10-15 15:16 ` Mark Mitchell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fzv7bk4p.fsf@orac.acorntoolworks.com \
--to=jtc@acorntoolworks.com \
--cc=gcc@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).