Commit 035181c3 by Jason Merrill Committed by Jason Merrill

PR c++/83714 - ICE checking return in template.

	* typeck.c (check_return_expr): Call build_non_dependent_expr.

From-SVN: r256765
parent a9db08a6
2018-01-16 Jason Merrill <jason@redhat.com>
PR c++/83714 - ICE checking return in template.
* typeck.c (check_return_expr): Call build_non_dependent_expr.
2018-01-16 Jakub Jelinek <jakub@redhat.com> 2018-01-16 Jakub Jelinek <jakub@redhat.com>
PR c++/83817 PR c++/83817
......
...@@ -9333,6 +9333,9 @@ check_return_expr (tree retval, bool *no_warning) ...@@ -9333,6 +9333,9 @@ check_return_expr (tree retval, bool *no_warning)
to undo it so we can try to treat it as an rvalue below. */ to undo it so we can try to treat it as an rvalue below. */
retval = maybe_undo_parenthesized_ref (retval); retval = maybe_undo_parenthesized_ref (retval);
if (processing_template_decl)
retval = build_non_dependent_expr (retval);
/* Under C++11 [12.8/32 class.copy], a returned lvalue is sometimes /* Under C++11 [12.8/32 class.copy], a returned lvalue is sometimes
treated as an rvalue for the purposes of overload resolution to treated as an rvalue for the purposes of overload resolution to
favor move constructors over copy constructors. favor move constructors over copy constructors.
......
// PR c++/83714
// { dg-do compile { target c++11 } }
class a {
typedef int b;
operator b();
};
struct c {
using d = a;
};
using e = c;
template <class T>
e f(T) {
return e::d {}; // { dg-error "could not convert" }
}
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