aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/method.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/method.c')
-rw-r--r--gcc/cp/method.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index f4a3ea6..0718f47 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -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. */