Commit 50aaebab by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/89391 (ICE in build_target_expr_with_type, at cp/tree.c:795)

	PR c++/89391
	* typeck.c (build_reinterpret_cast_1): Don't handle void to
	&& conversion go through build_target_expr_with_type.

	* g++.dg/cpp0x/reinterpret_cast2.C: New test.

From-SVN: r269008
parent 883c0796
2019-02-19 Jakub Jelinek <jakub@redhat.com> 2019-02-19 Jakub Jelinek <jakub@redhat.com>
PR c++/89391
* typeck.c (build_reinterpret_cast_1): Don't handle void to
&& conversion go through build_target_expr_with_type.
PR c++/89390 PR c++/89390
* error.c (qualified_name_lookup_error): Only call * error.c (qualified_name_lookup_error): Only call
suggest_alternative_in_scoped_enum if name is IDENTIFIER_NODE. suggest_alternative_in_scoped_enum if name is IDENTIFIER_NODE.
......
...@@ -7477,7 +7477,7 @@ build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p, ...@@ -7477,7 +7477,7 @@ build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p,
reinterpret_cast. */ reinterpret_cast. */
if (TYPE_REF_P (type)) if (TYPE_REF_P (type))
{ {
if (TYPE_REF_IS_RVALUE (type)) if (TYPE_REF_IS_RVALUE (type) && !VOID_TYPE_P (intype))
{ {
if (!obvalue_p (expr)) if (!obvalue_p (expr))
/* Perform the temporary materialization conversion. */ /* Perform the temporary materialization conversion. */
......
2019-02-19 Jakub Jelinek <jakub@redhat.com> 2019-02-19 Jakub Jelinek <jakub@redhat.com>
PR c++/89391
* g++.dg/cpp0x/reinterpret_cast2.C: New test.
PR c++/89390 PR c++/89390
* g++.dg/diagnostic/pr89390.C: New test. * g++.dg/diagnostic/pr89390.C: New test.
......
// PR c++/89391
// { dg-do compile { target c++11 } }
struct S { };
void
foo ()
{
auto a = reinterpret_cast<S&&>(foo ()); // { dg-error "invalid cast of an rvalue expression of type 'void' to type" }
}
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