mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-25 01:30:44 +08:00
c++: structural_comptypes addition
I had to debug structural_comptypes, and its complex if conditions and tail calling of same_type_p made that hard. I'd hope we can turn the eqivalent of return boolean_fn () ? true : false; into a tail call of the boolean. We also were not dealing with TYPEOF_TYPE. gcc/cp/ * typeck.c (structural_comptypes): [DECLTYPE_TYPE] break apart complex if. [UNDERLYING_TYPE]: Use an if. [TYPEOF_TYPE]: New.
This commit is contained in:
parent
0f32c94fc7
commit
5324a3e621
@ -1452,19 +1452,25 @@ structural_comptypes (tree t1, tree t2, int strict)
|
||||
|
||||
case DECLTYPE_TYPE:
|
||||
if (DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P (t1)
|
||||
!= DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P (t2)
|
||||
|| (DECLTYPE_FOR_LAMBDA_CAPTURE (t1)
|
||||
!= DECLTYPE_FOR_LAMBDA_CAPTURE (t2))
|
||||
|| (DECLTYPE_FOR_LAMBDA_PROXY (t1)
|
||||
!= DECLTYPE_FOR_LAMBDA_PROXY (t2))
|
||||
|| !cp_tree_equal (DECLTYPE_TYPE_EXPR (t1),
|
||||
DECLTYPE_TYPE_EXPR (t2)))
|
||||
!= DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P (t2))
|
||||
return false;
|
||||
if (DECLTYPE_FOR_LAMBDA_CAPTURE (t1) != DECLTYPE_FOR_LAMBDA_CAPTURE (t2))
|
||||
return false;
|
||||
if (DECLTYPE_FOR_LAMBDA_PROXY (t1) != DECLTYPE_FOR_LAMBDA_PROXY (t2))
|
||||
return false;
|
||||
if (!cp_tree_equal (DECLTYPE_TYPE_EXPR (t1), DECLTYPE_TYPE_EXPR (t2)))
|
||||
return false;
|
||||
break;
|
||||
|
||||
case UNDERLYING_TYPE:
|
||||
return same_type_p (UNDERLYING_TYPE_TYPE (t1),
|
||||
UNDERLYING_TYPE_TYPE (t2));
|
||||
if (!same_type_p (UNDERLYING_TYPE_TYPE (t1), UNDERLYING_TYPE_TYPE (t2)))
|
||||
return false;
|
||||
break;
|
||||
|
||||
case TYPEOF_TYPE:
|
||||
if (!cp_tree_equal (TYPEOF_TYPE_EXPR (t1), TYPEOF_TYPE_EXPR (t2)))
|
||||
return false;
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user