This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Renaming IS_AGGR_TYPE & co


Hi Mark,
-  else if (! is_aggr_type (base, 1))
+  else if (TREE_CODE (base) != TYPENAME_TYPE
+          && TREE_CODE (base) != TEMPLATE_TYPE_PARM
+          && TREE_CODE (base) != BOUND_TEMPLATE_TEMPLATE_PARM
+          && ! is_class_type (base, 1))
     result = NULL_TREE;

allows the testsuite to pass...
I think that in this case you want MAYBE_CLASS_TYPE_P.

Here, the compiler is checking to see if the type is a valid base class type. If it's a template type parameter, it *might* be a class type -- we just don't know yet. So, we want to accept it.
Ok, thanks, now I see the logic pretty clearly. Note however, that the current is_aggr_type (would be is_class_type), beyond MAYBE_CLASS_TYPE_P emits *error messages*, which currently wrongly talk about ""aggregate"". I understand that in this case only in order to preserve and improve the current behavior I should open code a check of MAYBE_CLASS_TYPE_P and an error message talking about... what?!?... just "class type" would be Ok for the error message?

Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]