PR c++/89705 - ICE with reference binding with conversion function.
* call.c (reference_binding): If the result of the conversion function is a prvalue of non-class type, use the cv-unqualified type. * g++.dg/cpp0x/rv-conv2.C: New test. From-SVN: r269918
This commit is contained in:
parent
8d6419db2c
commit
a55f758221
@ -1,3 +1,9 @@
|
||||
2019-03-25 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR c++/89705 - ICE with reference binding with conversion function.
|
||||
* call.c (reference_binding): If the result of the conversion function
|
||||
is a prvalue of non-class type, use the cv-unqualified type.
|
||||
|
||||
2019-03-25 Nathan Sidwell <nathan@acm.org>
|
||||
|
||||
* lambda.c (maybe_add_lambda_conv_op): Don't add to comdat group.
|
||||
|
@ -1853,6 +1853,9 @@ reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags,
|
||||
&& DECL_CONV_FN_P (t->cand->fn))
|
||||
{
|
||||
tree ftype = TREE_TYPE (TREE_TYPE (t->cand->fn));
|
||||
/* A prvalue of non-class type is cv-unqualified. */
|
||||
if (!TYPE_REF_P (ftype) && !CLASS_TYPE_P (ftype))
|
||||
ftype = cv_unqualified (ftype);
|
||||
int sflags = (flags|LOOKUP_NO_CONVERSION)&~LOOKUP_NO_TEMP_BIND;
|
||||
conversion *new_second
|
||||
= reference_binding (rto, ftype, NULL_TREE, c_cast_p,
|
||||
|
@ -1,3 +1,8 @@
|
||||
2019-03-25 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR c++/89705 - ICE with reference binding with conversion function.
|
||||
* g++.dg/cpp0x/rv-conv2.C: New test.
|
||||
|
||||
2019-03-25 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/89789
|
||||
|
18
gcc/testsuite/g++.dg/cpp0x/rv-conv2.C
Normal file
18
gcc/testsuite/g++.dg/cpp0x/rv-conv2.C
Normal file
@ -0,0 +1,18 @@
|
||||
// PR c++/89705
|
||||
// { dg-do compile { target c++11 } }
|
||||
|
||||
struct W { operator const volatile int(); };
|
||||
const int& rci = W();
|
||||
|
||||
struct X { operator const int(); };
|
||||
int&& rri = X();
|
||||
|
||||
struct Y { operator volatile int(); };
|
||||
int&& rri2 = Y();
|
||||
|
||||
struct Z { operator const volatile int(); };
|
||||
volatile int&& rri3 = Z();
|
||||
|
||||
enum E { A };
|
||||
struct S { operator const E(); };
|
||||
E&& rre = S();
|
Loading…
Reference in New Issue
Block a user