Message ID | 52A3B01A.6070006@oracle.com |
---|---|
State | New |
Headers | show |
Hmm, what if we make lookup_base handle incomplete types better? Jason
Hi,
On 12/12/2013 05:01 AM, Jason Merrill wrote:
> Hmm, what if we make lookup_base handle incomplete types better?
I'm leaving for a few days of vacations, then I can certainly look into
that, per se should be very doable. To be honest, I didn't consider that
possibility because I feared it could be risky wrt all the other users
of lookup_base, which are many. Do you think it would be safe for 4.9?
Thanks,
Paolo.
I wouldn't expect it to cause problems. Jason
Index: cp/semantics.c =================================================================== --- cp/semantics.c (revision 205782) +++ cp/semantics.c (working copy) @@ -7108,7 +7108,8 @@ trait_expr_value (cp_trait_kind kind, tree type1, case CPTK_IS_BASE_OF: return (NON_UNION_CLASS_TYPE_P (type1) && NON_UNION_CLASS_TYPE_P (type2) - && DERIVED_FROM_P (type1, type2)); + && (same_type_ignoring_top_level_qualifiers_p (type1, type2) + || DERIVED_FROM_P (type1, type2))); case CPTK_IS_CLASS: return (NON_UNION_CLASS_TYPE_P (type1)); Index: testsuite/g++.dg/ext/is_base_of_incomplete-2.C =================================================================== --- testsuite/g++.dg/ext/is_base_of_incomplete-2.C (revision 0) +++ testsuite/g++.dg/ext/is_base_of_incomplete-2.C (working copy) @@ -0,0 +1,5 @@ +struct T; + +int check1[__is_base_of(T, T) ? 1 : -1]; +int check2[__is_base_of(T, const T) ? 1 : -1]; +int check3[__is_base_of(volatile T, T) ? 1 : -1];