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: C++ PATCH to build_conditional_expr for c++/11283


2003-08-21  Jason Merrill  <jason@redhat.com>

        PR c++/11283
        * call.c (build_conditional_expr): Ignore cv-qual differences 
        for non-class types.

> ! 	  if (!same_type_p (TREE_TYPE (arg2), arg3_type)
> ! 	      && CLASS_TYPE_P (arg3_type))
> ! 	    /* The types need to match if we're converting to a class type.
> ! 	       If not, we don't care about cv-qual mismatches, since
> ! 	       non-class rvalues are not cv-qualified.  */

A more precise fix would be:

  if (CLASS_TYPE_P (arg3_type) 
      ? same_type_p (...)
      : same_type_ignoring_top_level_qualifiers_p (...))
   ...

That way we would still catch int vs. short, for example.

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com


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