Commit d78aecf4 by Jason Merrill Committed by Jason Merrill

PR c++/83227 - C++17 ICE with init-list derived-to-base conversion.

	* call.c (convert_like_real): Don't use the copy-list-initialization
	shortcut for ck_base.

From-SVN: r257720
parent d8865b6e
2018-02-15 Jason Merrill <jason@redhat.com> 2018-02-15 Jason Merrill <jason@redhat.com>
PR c++/83227 - C++17 ICE with init-list derived-to-base conversion.
* call.c (convert_like_real): Don't use the copy-list-initialization
shortcut for ck_base.
PR c++/84045 - ICE with typedef and noexcept. PR c++/84045 - ICE with typedef and noexcept.
* except.c (build_noexcept_spec): Use strip_typedefs_expr. * except.c (build_noexcept_spec): Use strip_typedefs_expr.
......
...@@ -6938,6 +6938,11 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, ...@@ -6938,6 +6938,11 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
&& DECL_INHERITED_CTOR (current_function_decl)) && DECL_INHERITED_CTOR (current_function_decl))
return expr; return expr;
if (TREE_CODE (expr) == TARGET_EXPR
&& TARGET_EXPR_LIST_INIT_P (expr))
/* Copy-list-initialization doesn't actually involve a copy. */
return expr;
/* Fall through. */ /* Fall through. */
case ck_base: case ck_base:
if (convs->kind == ck_base && !convs->need_temporary_p) if (convs->kind == ck_base && !convs->need_temporary_p)
...@@ -6964,10 +6969,6 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, ...@@ -6964,10 +6969,6 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
if (convs->rvaluedness_matches_p) if (convs->rvaluedness_matches_p)
/* standard_conversion got LOOKUP_PREFER_RVALUE. */ /* standard_conversion got LOOKUP_PREFER_RVALUE. */
flags |= LOOKUP_PREFER_RVALUE; flags |= LOOKUP_PREFER_RVALUE;
if (TREE_CODE (expr) == TARGET_EXPR
&& TARGET_EXPR_LIST_INIT_P (expr))
/* Copy-list-initialization doesn't actually involve a copy. */
return expr;
expr = build_temp (expr, totype, flags, &diag_kind, complain); expr = build_temp (expr, totype, flags, &diag_kind, complain);
if (diag_kind && complain) if (diag_kind && complain)
{ {
......
// PR c++/83227
// { dg-do compile { target c++11 } }
#include <initializer_list>
template <typename d> struct f {
f(std::initializer_list<d>) {}
};
struct h {};
struct i : h {
i();
};
void foo(f<h>);
int main() {
foo({i{}});
}
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