On 18/05/17 13:44 -0400, Nathan Sidwell wrote:
On 05/18/2017 01:40 PM, Jonathan Wakely wrote:

+  /* A prvalue of non-class type is cv-unqualified.  */
+  if (TREE_CODE (type) != REFERENCE_TYPE && !CLASS_TYPE_P (type))
+    type = cv_unqualified (type);
+

References can't be CV qualified, so the REFERENCE_TYPE check seems superfluous?

True. I did it because that matches the semantics of the cast
according to the standard, but it isn't needed here. Is it worth
keeping anyway, to avoid a redundant call to cv_unqualified?

It also occurs to me that checking for !CLASS_TYPE_P (type) isn't
needed in build_const_cast_1 because you can't const_cast to a class
type, only reference or pointer types.


Reply via email to