public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14075] New: ("foo") accepted as char[] initializer
@ 2004-02-08 19:00 porten at kde dot org
2004-02-08 20:08 ` [Bug c++/14075] " pinskia at gcc dot gnu dot org
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: porten at kde dot org @ 2004-02-08 19:00 UTC (permalink / raw)
To: gcc-bugs
The following code should not be accepted according to what I understand from
section 8.5.2 in the latest standard edition I could find:
int main()
{
const char s[] = ("foo");
}
HP's aCC throws an "Illegal initializer" error on this one for example.
Note that this report is similar to #11250. This time it's about the C++
frontend, though.
Harri.
--
Summary: ("foo") accepted as char[] initializer
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: porten at kde dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14075
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/14075] ("foo") accepted as char[] initializer
2004-02-08 19:00 [Bug c++/14075] New: ("foo") accepted as char[] initializer porten at kde dot org
@ 2004-02-08 20:08 ` pinskia at gcc dot gnu dot org
2004-07-27 3:06 ` pinskia at gcc dot gnu dot org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-08 20:08 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-02-08 20:08 -------
Confirmed, ICC 6.0 only rejects it when in "pedantic" mode:
pr14075.cc
pr14075.cc(3): error: initialization with "{...}" expected for aggregate object
const char s[] = ("foo");
^
compilation aborted for pr14075.cc (code 2)
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |accepts-invalid
Known to fail| |3.5.0 3.3.3 3.0.4 3.3.1
| |3.2.3 3.2.2 3.4.0 2.95.3
Last reconfirmed|0000-00-00 00:00:00 |2004-02-08 20:08:27
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14075
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/14075] ("foo") accepted as char[] initializer
2004-02-08 19:00 [Bug c++/14075] New: ("foo") accepted as char[] initializer porten at kde dot org
2004-02-08 20:08 ` [Bug c++/14075] " pinskia at gcc dot gnu dot org
@ 2004-07-27 3:06 ` pinskia at gcc dot gnu dot org
2004-12-09 0:26 ` pinskia at gcc dot gnu dot org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-27 3:06 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-07-27 03:06 -------
Note that this is fixed on the mainline for the C case.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14075
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/14075] ("foo") accepted as char[] initializer
2004-02-08 19:00 [Bug c++/14075] New: ("foo") accepted as char[] initializer porten at kde dot org
2004-02-08 20:08 ` [Bug c++/14075] " pinskia at gcc dot gnu dot org
2004-07-27 3:06 ` pinskia at gcc dot gnu dot org
@ 2004-12-09 0:26 ` pinskia at gcc dot gnu dot org
2004-12-09 10:57 ` joseph at codesourcery dot com
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-09 0:26 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-12-09 00:26 -------
Fixed on the mainline:
tt.c:3: warning: array initialized from parenthesized string constant
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Known to fail|4.0 3.3.3 3.0.4 3.3.1 3.2.3 |3.3.3 3.0.4 3.3.1 3.2.3
|3.2.2 3.4.0 2.95.3 |3.2.2 3.4.0 2.95.3
Known to work| |4.0.0
Resolution| |FIXED
Target Milestone|--- |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14075
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/14075] ("foo") accepted as char[] initializer
2004-02-08 19:00 [Bug c++/14075] New: ("foo") accepted as char[] initializer porten at kde dot org
` (2 preceding siblings ...)
2004-12-09 0:26 ` pinskia at gcc dot gnu dot org
@ 2004-12-09 10:57 ` joseph at codesourcery dot com
2004-12-09 12:35 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: joseph at codesourcery dot com @ 2004-12-09 10:57 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From joseph at codesourcery dot com 2004-12-09 10:57 -------
Subject: Re: ("foo") accepted as char[] initializer
On Thu, 9 Dec 2004, pinskia at gcc dot gnu dot org wrote:
> Fixed on the mainline:
> tt.c:3: warning: array initialized from parenthesized string constant
Why are you closing C++ bugs based on C testing again? You already knew
that this is a C++ bug and the C bug was fixed separately - you said as
much in comment#2.
Closing bugs that aren't fixed by testing the wrong compiler is not a
reasonable way of reducing the bug count.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14075
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/14075] ("foo") accepted as char[] initializer
2004-02-08 19:00 [Bug c++/14075] New: ("foo") accepted as char[] initializer porten at kde dot org
` (3 preceding siblings ...)
2004-12-09 10:57 ` joseph at codesourcery dot com
@ 2004-12-09 12:35 ` pinskia at gcc dot gnu dot org
2004-12-16 11:41 ` nathan at gcc dot gnu dot org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-09 12:35 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-12-09 12:35 -------
The reason sometimes it is hard to see if a bug is against the C++ front-end, I always look at the title
of the window which includes the summary but not the component.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Known to fail|3.3.3 3.0.4 3.3.1 3.2.3 |3.3.3 3.0.4 3.3.1 3.2.3
|3.2.2 3.4.0 2.95.3 |3.2.2 3.4.0 2.95.3 4.0.0
Known to work|4.0.0 |
Resolution|FIXED |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14075
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/14075] ("foo") accepted as char[] initializer
2004-02-08 19:00 [Bug c++/14075] New: ("foo") accepted as char[] initializer porten at kde dot org
` (4 preceding siblings ...)
2004-12-09 12:35 ` pinskia at gcc dot gnu dot org
@ 2004-12-16 11:41 ` nathan at gcc dot gnu dot org
2004-12-16 16:03 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: nathan at gcc dot gnu dot org @ 2004-12-16 11:41 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From nathan at gcc dot gnu dot org 2004-12-16 11:41 -------
what a silly restriction ...
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |nathan at gcc dot gnu dot
|dot org |org
Status|REOPENED |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14075
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/14075] ("foo") accepted as char[] initializer
2004-02-08 19:00 [Bug c++/14075] New: ("foo") accepted as char[] initializer porten at kde dot org
` (5 preceding siblings ...)
2004-12-16 11:41 ` nathan at gcc dot gnu dot org
@ 2004-12-16 16:03 ` pinskia at gcc dot gnu dot org
2004-12-21 17:54 ` cvs-commit at gcc dot gnu dot org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-16 16:03 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.0.0 |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14075
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/14075] ("foo") accepted as char[] initializer
2004-02-08 19:00 [Bug c++/14075] New: ("foo") accepted as char[] initializer porten at kde dot org
` (6 preceding siblings ...)
2004-12-16 16:03 ` pinskia at gcc dot gnu dot org
@ 2004-12-21 17:54 ` cvs-commit at gcc dot gnu dot org
2004-12-21 18:29 ` nathan at gcc dot gnu dot org
2004-12-21 19:28 ` gdr at integrable-solutions dot net
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-12-21 17:54 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-12-21 17:54 -------
Subject: Bug 14075
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: nathan@gcc.gnu.org 2004-12-21 17:54:27
Modified files:
gcc/cp : ChangeLog cp-tree.h decl.c error.c semantics.c
gcc/testsuite : ChangeLog
Log message:
cp:
PR c++/14075
* decl.c (check_initializer): Check string initializer of array is
not parenthesized.
* cp-tree.h (PAREN_STRING_LITERAL_P): New.
* semantics.c (finish_parenthesized_expr): Mark a STRING_CST.
* error.c (dump_expr): <STRING_CST case> Add parens, if needed.
testsuite:
PR c++/14075
* g++.dg/init/string1.C: New.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4546&r2=1.4547
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.1084&r2=1.1085
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1343&r2=1.1344
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/error.c.diff?cvsroot=gcc&r1=1.274&r2=1.275
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/semantics.c.diff?cvsroot=gcc&r1=1.453&r2=1.454
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4791&r2=1.4792
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14075
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/14075] ("foo") accepted as char[] initializer
2004-02-08 19:00 [Bug c++/14075] New: ("foo") accepted as char[] initializer porten at kde dot org
` (7 preceding siblings ...)
2004-12-21 17:54 ` cvs-commit at gcc dot gnu dot org
@ 2004-12-21 18:29 ` nathan at gcc dot gnu dot org
2004-12-21 19:28 ` gdr at integrable-solutions dot net
9 siblings, 0 replies; 11+ messages in thread
From: nathan at gcc dot gnu dot org @ 2004-12-21 18:29 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From nathan at gcc dot gnu dot org 2004-12-21 18:28 -------
2004-12-16 Nathan Sidwell <nathan@codesourcery.com>
PR c++/14075
* decl.c (check_initializer): Check string initializer of array is
not parenthesized.
* cp-tree.h (PAREN_STRING_LITERAL_P): New.
* semantics.c (finish_parenthesized_expr): Mark a STRING_CST.
* error.c (dump_expr): <STRING_CST case> Add parens, if needed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14075
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/14075] ("foo") accepted as char[] initializer
2004-02-08 19:00 [Bug c++/14075] New: ("foo") accepted as char[] initializer porten at kde dot org
` (8 preceding siblings ...)
2004-12-21 18:29 ` nathan at gcc dot gnu dot org
@ 2004-12-21 19:28 ` gdr at integrable-solutions dot net
9 siblings, 0 replies; 11+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-12-21 19:28 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gdr at integrable-solutions dot net 2004-12-21 19:27 -------
Subject: Re: ("foo") accepted as char[] initializer
"nathan at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:
| 2004-12-16 Nathan Sidwell <nathan@codesourcery.com>
|
| PR c++/14075
| * decl.c (check_initializer): Check string initializer of array is
| not parenthesized.
| * cp-tree.h (PAREN_STRING_LITERAL_P): New.
| * semantics.c (finish_parenthesized_expr): Mark a STRING_CST.
| * error.c (dump_expr): <STRING_CST case> Add parens, if needed.
The change for error.c is wrong. It should have been in
gccp/c-pretty-print.c. And the flag should have been common to both C
and C++ too.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14075
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2004-12-21 19:28 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-08 19:00 [Bug c++/14075] New: ("foo") accepted as char[] initializer porten at kde dot org
2004-02-08 20:08 ` [Bug c++/14075] " pinskia at gcc dot gnu dot org
2004-07-27 3:06 ` pinskia at gcc dot gnu dot org
2004-12-09 0:26 ` pinskia at gcc dot gnu dot org
2004-12-09 10:57 ` joseph at codesourcery dot com
2004-12-09 12:35 ` pinskia at gcc dot gnu dot org
2004-12-16 11:41 ` nathan at gcc dot gnu dot org
2004-12-16 16:03 ` pinskia at gcc dot gnu dot org
2004-12-21 17:54 ` cvs-commit at gcc dot gnu dot org
2004-12-21 18:29 ` nathan at gcc dot gnu dot org
2004-12-21 19:28 ` gdr at integrable-solutions dot net
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).