c++/8727: compiler confused by inheritance from an anonymous struct

jbuck@synopsys.com jbuck@synopsys.com
Tue Nov 26 17:40:00 GMT 2002


>Number:         8727
>Category:       c++
>Synopsis:       compiler confused by inheritance from an anonymous struct
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 26 17:26:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Joe Buck
>Release:        3.2.1
>Organization:
>Environment:
i686-pc-linux-gnu
>Description:
This bug was reported by
jelenz@students.wisc.edu (John Lenz).

Attempting to inherit from a typedef'd anonymous struct seems
to confuse gcc (possibly in the generation of typeinfo or
virtual function tables).  The example given here works
with gcc-2.95.x and Red Hat's gcc 2.96, but fails with
gcc 3.0.x through gcc 3.2.1.
>How-To-Repeat:
gcc -c bb.cxx
gives
bb.cxx:10: redefinition of `const char _ZTS4Heya[6]'
bb.cxx:10: `const char _ZTS4Heya[6]' previously defined here
>Fix:
Of course we can work around this by avoiding the anonymous
struct, so it's non-critical, even if it is a regression.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="bb.cxx"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="bb.cxx"

dHlwZWRlZiBzdHJ1Y3QgewogICB2aXJ0dWFsIGNvbnN0IGNoYXIgKmJsYWgoKSB7CiAgICAgcmV0
dXJuICJIZXlhOjpibGFoIjsKICAgfQp9IEhleWE7CgpzdHJ1Y3QgR3JvayA6IHB1YmxpYyBIZXlh
IHsKICAgdmlydHVhbCBjb25zdCBjaGFyICpibGFoKCkgewogICAgIHJldHVybiAiR3Jvazo6Ymxh
aCI7CiAgIH0KfTsKCmludCBtYWluKCkgewogICBHcm9rICpnID0gbmV3IEdyb2soKTsKICAgZGVs
ZXRlIGc7CiAgIHJldHVybiAwOwp9Cgo=



More information about the Gcc-bugs mailing list