summaryrefslogtreecommitdiff
path: root/gcc/cp/call.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/call.cc')
-rw-r--r--gcc/cp/call.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc
index 48611bb16a3..908374a43c9 100644
--- a/gcc/cp/call.cc
+++ b/gcc/cp/call.cc
@@ -4129,6 +4129,14 @@ add_list_candidates (tree fns, tree first_arg,
if (CONSTRUCTOR_NELTS (init_list) == 0
&& TYPE_HAS_DEFAULT_CONSTRUCTOR (totype))
;
+ else if (CONSTRUCTOR_IS_DESIGNATED_INIT (init_list)
+ && !CP_AGGREGATE_TYPE_P (totype))
+ {
+ if (complain & tf_error)
+ error ("designated initializers cannot be used with a "
+ "non-aggregate type %qT", totype);
+ return;
+ }
/* If the class has a list ctor, try passing the list as a single
argument first, but only consider list ctors. */
else if (TYPE_HAS_LIST_CTOR (totype))
@@ -4140,14 +4148,6 @@ add_list_candidates (tree fns, tree first_arg,
if (any_strictly_viable (*candidates))
return;
}
- else if (CONSTRUCTOR_IS_DESIGNATED_INIT (init_list)
- && !CP_AGGREGATE_TYPE_P (totype))
- {
- if (complain & tf_error)
- error ("designated initializers cannot be used with a "
- "non-aggregate type %qT", totype);
- return;
- }
/* Expand the CONSTRUCTOR into a new argument vec. */
vec<tree, va_gc> *new_args;