aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2012-07-20 02:29:13 -0400
committerJason Merrill <jason@gcc.gnu.org>2012-07-20 02:29:13 -0400
commit6d876e0b31aab2bf03e93b1d4705330f20f2c656 (patch)
treebaef4220044fb92168ef5b16a7e69b0d9aa7c9bd /gcc/cp
parentc62c6622bcf2906969975f5741072d842c667851 (diff)
downloadgcc-6d876e0b31aab2bf03e93b1d4705330f20f2c656.zip
gcc-6d876e0b31aab2bf03e93b1d4705330f20f2c656.tar.gz
gcc-6d876e0b31aab2bf03e93b1d4705330f20f2c656.tar.bz2
re PR c++/54026 (template const struct with mutable members erroneously emitted to .rodata)
PR c++/54026 * typeck.c (cp_apply_type_quals_to_decl): Check COMPLETE_TYPE_P. From-SVN: r189701
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/typeck.c6
2 files changed, 6 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 649b656..647b719 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2012-07-19 Jason Merrill <jason@redhat.com>
+ PR c++/54026
+ * typeck.c (cp_apply_type_quals_to_decl): Check COMPLETE_TYPE_P.
+
PR c++/54021
* call.c (build_cxx_call): Set optimize when folding
__builtin_constant_p in a constexpr function.
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 508e8fb..d7a719f 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -8453,9 +8453,9 @@ cp_apply_type_quals_to_decl (int type_quals, tree decl)
constructor can produce constant init, so rely on cp_finish_decl to
clear TREE_READONLY if the variable has non-constant init. */
- /* If the type has a mutable component, that component might be
- modified. */
- if (TYPE_HAS_MUTABLE_P (type))
+ /* If the type has (or might have) a mutable component, that component
+ might be modified. */
+ if (TYPE_HAS_MUTABLE_P (type) || !COMPLETE_TYPE_P (type))
type_quals &= ~TYPE_QUAL_CONST;
c_apply_type_quals_to_decl (type_quals, decl);