From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17281 invoked by alias); 15 Oct 2002 18:55:36 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 17274 invoked from network); 15 Oct 2002 18:55:34 -0000 Received: from unknown (HELO rumms.uni-mannheim.de) (134.155.50.52) by sources.redhat.com with SMTP; 15 Oct 2002 18:55:34 -0000 Received: from moonlight (p50841CBF.dip.t-dialin.net [80.132.28.191]) (authenticated) by rumms.uni-mannheim.de (8.11.0/8.11.0) with ESMTP id g9FItTH15615; Tue, 15 Oct 2002 20:55:29 +0200 (MEST) Content-Type: text/plain; charset="iso-8859-1" From: Michael Ritzert To: jtc@acorntoolworks.com Subject: Re: string literals in struct initializers with C++ Date: Tue, 15 Oct 2002 13:04:00 -0000 User-Agent: KMail/1.4.3 References: <87vg43bn4i.fsf@orac.acorntoolworks.com> In-Reply-To: <87vg43bn4i.fsf@orac.acorntoolworks.com> Cc: gcc@gcc.gnu.org MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200210152055.42973.mritzert@ti.uni-mannheim.de> X-SW-Source: 2002-10/txt/msg00854.txt.bz2 On Tuesday 15 October 2002 19:58, J.T. Conklin wrote: > The following code: > > struct foo { > char x[20]; > int y; > int z; > }; > > struct foo foos[] =3D { > { "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' I hit the same error message during my daily build of STLport. The simplifi= ed=20 code looks like this: -bash-2.05b$ gcc -v Reading specs from=20 /home/ritzert/gcc-HEAD/install/lib/gcc-lib/i386-unknown-freebsd4.5/3.3/specs Configured with: /home/ritzert/gcc-HEAD/gcc/configure --enable-threads=3Dpo= six=20 --prefix=3D/home/ritzert/gcc-HEAD/install Thread model: posix gcc version 3.3 20021014 (experimental) -bash-2.05b$ cat x.cpp const char x[][2] =3D { "Hello", "world" }; -bash-2.05b$ gcc -c x.cpp x.cpp:1: error: invalid conversion from `const char*' to `char' x.cpp:1: error: invalid conversion from `const char*' to `char' It compiled fine just a week ago. (Sorry, I can't be more precise; first th= ere=20 was the anoncvs update problem, then my build machine went down...). Michael