Commit f0ccda52 authored by jason's avatar jason
Browse files

PR c++/50507

	* method.c (walk_field_subobs): Check for NSDMI before
	complaining about uninitialized fields.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180002 138bc75d-0d04-0410-961f-82ee72b054a4
parent 05f654b9
2011-10-14 Jason Merrill <jason@redhat.com>
PR c++/50507
* method.c (walk_field_subobs): Check for NSDMI before
complaining about uninitialized fields.
* pt.c (tsubst_decl) [FIELD_DECL]: Use void_zero_node
instead of error_mark_node as a placeholder.
......
......@@ -1016,25 +1016,7 @@ walk_field_subobs (tree fields, tree fnname, special_function_kind sfk,
}
else if (sfk == sfk_constructor)
{
bool bad = true;
if (CP_TYPE_CONST_P (mem_type)
&& default_init_uninitialized_part (mem_type))
{
if (msg)
error ("uninitialized non-static const member %q#D",
field);
}
else if (TREE_CODE (mem_type) == REFERENCE_TYPE)
{
if (msg)
error ("uninitialized non-static reference member %q#D",
field);
}
else
bad = false;
if (bad && deleted_p)
*deleted_p = true;
bool bad;
if (DECL_INITIAL (field))
{
......@@ -1057,6 +1039,26 @@ walk_field_subobs (tree fields, tree fnname, special_function_kind sfk,
continue;
}
bad = false;
if (CP_TYPE_CONST_P (mem_type)
&& default_init_uninitialized_part (mem_type))
{
if (msg)
error ("uninitialized non-static const member %q#D",
field);
bad = true;
}
else if (TREE_CODE (mem_type) == REFERENCE_TYPE)
{
if (msg)
error ("uninitialized non-static reference member %q#D",
field);
bad = true;
}
if (bad && deleted_p)
*deleted_p = true;
/* For an implicitly-defined default constructor to be constexpr,
every member must have a user-provided default constructor or
an explicit initializer. */
......
2011-10-14 Jason Merrill <jason@redhat.com>
PR c++/50507
* g++.dg/cpp0x/nsdmi-const1.C: New.
2011-10-14 Janus Weil <janus@gcc.gnu.org>
PR fortran/50570
......
// PR c++/50707
// { dg-options -std=c++0x }
int g;
struct S {
int const v=g;
};
S s;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment