+2018-04-05 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/80956
+ * call.c (convert_like_real): Fail gracefully for a broken
+ std::initializer_list, missing a definition.
+
+ * name-lookup.c (do_pushtag): Tweak message, use %< and %>.
+
2018-04-05 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/84792
if (array == error_mark_node)
return error_mark_node;
- /* Build up the initializer_list object. */
- totype = complete_type (totype);
+ /* Build up the initializer_list object. Note: fail gracefully
+ if the object cannot be completed because, for example, no
+ definition is provided (c++/80956). */
+ totype = complete_type_or_maybe_complain (totype, NULL_TREE, complain);
+ if (!totype)
+ return error_mark_node;
field = next_initializable_field (TYPE_FIELDS (totype));
CONSTRUCTOR_APPEND_ELT (vec, field, array);
field = next_initializable_field (DECL_CHAIN (field));
&& init_list_identifier == DECL_NAME (TYPE_NAME (type))
&& !CLASSTYPE_TEMPLATE_INFO (type))
{
- error ("declaration of std::initializer_list does not match "
- "#include <initializer_list>, isn't a template");
+ error ("declaration of %<std::initializer_list%> does not match "
+ "%<#include <initializer_list>%>, isn't a template");
return error_mark_node;
}
}
+2018-04-05 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/80956
+ * g++.dg/cpp0x/initlist100.C: New.
+ * g++.dg/cpp0x/initlist101.C: Likewise.
+
2018-04-05 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/84792
--- /dev/null
+// PR c++/80956
+// { dg-do compile { target c++11 } }
+
+namespace std {
+template <class> class initializer_list; // { dg-message "declaration" }
+}
+
+template <typename T> struct B { B (std::initializer_list<T>); };
+struct C { virtual int foo (); };
+struct D : C {} d { B<C> { D {} } }; // { dg-error "incomplete|no matching" }
--- /dev/null
+// PR c++/80956
+// { dg-do compile { target c++11 } }
+
+#include <initializer_list>
+
+template <typename T> struct B { B (std::initializer_list<T>); };
+struct C { virtual int foo (); };
+struct D : C {} d { B<C> { D {} } }; // { dg-error "no matching" }