Commit 61f84e25 by Paolo Carlini Committed by Paolo Carlini

re PR c++/80956 (ICE with abstract class vector)

/cp
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 %>.

/testsuite
2018-04-05  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/80956
	* g++.dg/cpp0x/initlist100.C: New.
	* g++.dg/cpp0x/initlist101.C: Likewise.

From-SVN: r259137
parent 3b4a12aa
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
* decl.c (grokdeclarator): Fix diagnostic about typedef name used
as nested-name-specifier, keep type and TREE_TYPE (decl) in sync.
......
......@@ -6880,8 +6880,12 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
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));
......
......@@ -6476,8 +6476,8 @@ do_pushtag (tree name, tree type, tag_scope scope)
&& 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
* g++.dg/other/pr84792-1.C: New.
* g++.dg/other/pr84792-2.C: Likewise.
......
// 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" }
// 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" }
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