This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/54026] New: [4.7/4.8 regression] template const struct with mutable members erroneously emitted to .rodata
- From: "ppluzhnikov at google dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 19 Jul 2012 04:09:27 +0000
- Subject: [Bug c++/54026] New: [4.7/4.8 regression] template const struct with mutable members erroneously emitted to .rodata
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54026
Bug #: 54026
Summary: [4.7/4.8 regression] template const struct with
mutable members erroneously emitted to .rodata
Classification: Unclassified
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: ppluzhnikov@google.com
Reproduced with 4.7 and current trunk:
g++ (GCC) 4.8.0 20120719 (experimental)
// --- cut here ---
void non_const(int *);
template <typename T>
struct Foo {
T x;
mutable int y;
void func() const { non_const(&y); }
};
struct Bar {
int x;
mutable int y;
void func() const { non_const(&y); }
};
const Foo<int> foo = { 1, 2 };
const Bar bar = { 3, 4 };
// --- cut here ---
Results in:
.data
.align 4
.type _ZL3bar, @object
.size _ZL3bar, 8
_ZL3bar:
.long 3
.long 4
.section .rodata
.align 4
.type _ZL3foo, @object
.size _ZL3foo, 8
_ZL3foo:
.long 1
.long 2
But it is a bug to place "foo" into .rodata, since it contains a mutable
member.