+2011-07-08 Jason Merrill <jason@redhat.com>
+
+ PR c++/49673
+ * c-common.c (c_apply_type_quals_to_decl): Don't check
+ TYPE_NEEDS_CONSTRUCTING.
+
2011-07-06 Richard Guenther <rguenther@suse.de>
* c-common.c (c_common_nodes_and_builtins):
if (type == error_mark_node)
return;
- if (((type_quals & TYPE_QUAL_CONST)
- || (type && TREE_CODE (type) == REFERENCE_TYPE))
- /* An object declared 'const' is only readonly after it is
- initialized. We don't have any way of expressing this currently,
- so we need to be conservative and unset TREE_READONLY for types
- with constructors. Otherwise aliasing code will ignore stores in
- an inline constructor. */
- && !(type && TYPE_NEEDS_CONSTRUCTING (type)))
+ if ((type_quals & TYPE_QUAL_CONST)
+ || (type && TREE_CODE (type) == REFERENCE_TYPE))
+ /* We used to check TYPE_NEEDS_CONSTRUCTING here, but now a constexpr
+ constructor can produce constant init, so rely on cp_finish_decl to
+ clear TREE_READONLY if the variable has non-constant init. */
TREE_READONLY (decl) = 1;
if (type_quals & TYPE_QUAL_VOLATILE)
{
+2011-07-08 Jason Merrill <jason@redhat.com>
+
+ PR c++/49673
+ * typeck.c (cp_apply_type_quals_to_decl): Don't check
+ TYPE_NEEDS_CONSTRUCTING.
+
2011-07-07 Jason Merrill <jason@redhat.com>
PR c++/49663
&& type_quals != TYPE_UNQUALIFIED));
/* Avoid setting TREE_READONLY incorrectly. */
- if (/* If the object has a constructor, the constructor may modify
- the object. */
- TYPE_NEEDS_CONSTRUCTING (type)
- /* If the type isn't complete, we don't know yet if it will need
+ /* We used to check TYPE_NEEDS_CONSTRUCTING here, but now a constexpr
+ constructor can produce constant init, so rely on cp_finish_decl to
+ clear TREE_READONLY if the variable has non-constant init. */
+ if (/* If the type isn't complete, we don't know yet if it will need
constructing. */
- || !COMPLETE_TYPE_P (type)
+ !COMPLETE_TYPE_P (type)
/* If the type has a mutable component, that component might be
modified. */
|| TYPE_HAS_MUTABLE_P (type))
+2011-07-08 Jason Merrill <jason@redhat.com>
+
+ PR c++/49673
+ * g++.dg/cpp0x/constexpr-rom.C: New.
+
2011-07-08 Kirill Yukhin <kirill.yukhin@intel.com>
PR middle-end/49519
--- /dev/null
+// PR c++/49673: check that test_data goes into .rodata
+// { dg-options -std=c++0x }
+// { dg-final { scan-assembler "rodata" } }
+
+struct Data
+{
+ int i;
+ constexpr Data(int i = 0) : i(i+1) {}
+};
+
+extern const Data test_data = { 1 };