public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/7214: const declaration syntax and multiple definitions
@ 2002-07-05 2:56 yuri.delia
0 siblings, 0 replies; 2+ messages in thread
From: yuri.delia @ 2002-07-05 2:56 UTC (permalink / raw)
To: gcc-gnats
>Number: 7214
>Category: c++
>Synopsis: const declaration syntax and multiple definitions
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jul 05 02:56:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Yuri D'Elia
>Release: g++ 2.95.3, g++ 3.0, g++ 3.1 from current stable branch
>Organization:
>Environment:
debian GNU/Linux 3.0, x86
>Description:
Declaring a costant charater array using this syntax:
const char* array("test");
or
const char* array = "test";
withing multiple compilation units leads to a multiple
definition at the linking stage.
defining an array using this syntax:
const char array[]("test");
seems to be unallowed. wich is correct.
The unique way to define a correct and working constant
character array is this one:
const char array[] = "test";
I attach four test cases.
just run:
make prog1 prog2 # should fail with multiple definitions
make prog3 # deprecated syntax
make prog4 # working
the first two test cases (prog1, prog2) are probably
a software bug.
>How-To-Repeat:
See the attachment.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/x-tgz; name="gccBug.tar.gz"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="gccBug.tar.gz"
H4sIAIJoJT0AA+2aS2+bQBDHfc1+ipXtSHYsu/sCJLeRqkY9RE3aHiNFUYXWYKM6YGHcpqr63bvA
GoEfbS+sqZnfAWJmBGMvf+YR5lK+28xfdeqEEEEcy1J7wghn6Z4QW+9zOsqBUmYLavMOoVQod2zV
GpVms07cGOPOd/eb9/Jy3E+5+b6JgMwyz9f/3v3q+cHSq+UahKrlFuTo+jvC2a4/F5byo1zdAR1M
aolmh5avf6+Hn/XaI9TDcjTCMnpeqY8xunl4wNNrPB+NxnxCU3O8WXprdPPp/vPt3Xt8jfsD5TPE
Y4nHEe6/xf036O7244eSJT88QuhyEk3x5URKdKFs+RmG6TnVzz/3kjVyl8spXsXRnGZblm15thUI
ZYapijUIJxHehEFCx7T4i02i9LTptYe5L6v4ssKXHfDlFV9e+PIDvqLiKwpfseMrl54bTtFF/IzH
Pr5SNvVVZ95qjfZin2I3jt0fdLJYoL1gtZFtjZXotJFvjZVwtFGkRnR0/bX+t0FJWcM9lutfHH/+
M2urf2YRK9O/xUD/JugFoVxuZh7uFjdh9/jdApwbFf2zBujf4Zn+bQL6NwHov91o/Wc1TS3i7/yD
/qld6J9Zyo8yh1DQvwmCMEHp4g+G6OcvEH7r0PovHv51XONv+qe06P+ZcESW/x3o/43QC/xw5vm6
Bf2iesWe+hiEXukIklG4TrBcuPGVPjzo+m6YuOskkN3ha9XbeuEs8P/QZwLNpKx/dir9s2L+y7JZ
YKp/6P+NUNE/29M/O6x/hq9x6QkAD4D/llL/z5ow/3NsO+//If8bYaf/Z9D/t4uK/hsw/3O28z8O
+jcB6L/dlOt/fvr6n1MO+d8klfqf79X/fKf+10cfn2AAcB6U8j9vQP3PqZXP/9L3v0D/9bOT/znk
/3ZR0f/p639OHZ3/Yf5nBNB/uynX/+Jk9T8t9M/t/P1fG/K/ESr1v9ir/8XB+l88PsE/AM6DUv4X
Taj/BWHw/q9BdvK/gPzfLir6b0D9LyjN9Q/zfyOA/gEAAAAAAAAAAAAAAAAAAADg/PgNB6AkYgBQ
AAA=
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: c++/7214: const declaration syntax and multiple definitions
@ 2002-07-05 3:09 nathan
0 siblings, 0 replies; 2+ messages in thread
From: nathan @ 2002-07-05 3:09 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, nobody, yuri.delia
Synopsis: const declaration syntax and multiple definitions
State-Changed-From-To: open->closed
State-Changed-By: nathan
State-Changed-When: Fri Jul 5 03:09:52 2002
State-Changed-Why:
not a bug.
char const *foo ("vcalue");
is not defining a const array, but a non-const pointer
to char. As you have multiple definitions of a non-const
object, it is an error.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7214
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-07-05 10:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-05 2:56 c++/7214: const declaration syntax and multiple definitions yuri.delia
2002-07-05 3:09 nathan
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).