This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/7214: const declaration syntax and multiple definitions


>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=


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]