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]

Re: C++ PATCH: typedefs breaking conversions


Jason Merrill wrote:
> 
> This one shouldn't be necessary; TYPE_MAIN_VARIANTs can be compared with
> ==.
Then something's gone wrong with TYPE_MAIN_VARIANT. Martin's test case was

  typedef int Int;
  int *p;
  Int *&pr2 = p;

'Int *' and 'int *' are the same type (7.1.3/1), so comp_target_types should
return 1. However, after extracting the TYPE_MAIN_VARIANTs, we (still) have
ttl -> Int *
ttr -> int *
ttl = 0x327cb0
ttr = 0x315d78

What happens is that build_pointer_type (gcc/tree.c), constructs a pointer to
`Int' and labels it as its own main variant. This is wrong, because the pointed
to type is a typedef. build_reference_type has the same behaviour, and I'd
guess the assumption is in other places too. Because this is grunging around in
rather a core part of the compiler, I don't feel qualified to attack the
problem.

In the meantime, I withdraw the entire patch (but not the testcase), as the
problem in convert_pointer_to_real is the same.

nathan
-- 
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
      You can up the bandwidth, but you can't up the speed of light      
nathan@acm.org  http://www.cs.bris.ac.uk/~nathan/  nathan@cs.bris.ac.uk


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