This is the mail archive of the gcc@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: array decays too fast.


Mark Mitchell writes:
 > >>>>> "Nathan" == Nathan Myers <ncm@nospam.cantrip.org> writes:
 > 
 >     Nathan> In egcs-2.91.50, the type of an array decays too readily
 >     Nathan> to a pointer, so that a conversion from T to const T&
 >     Nathan> fails, and template type matching fails.  (EDG-2.38
 >     Nathan> accepts this code.)
 > 
 > I'm working on reworking the reference initialization code (there are
 > a lot of minor bugs in that area).  Expect a fix some time next week. 

Thanks.  I have an amusing variation that shows a (forbidden, I think)
variation between old and new cast syntaxes.  I don't know if it's
exercising another of the bugs you mentioned.

-----------------------
struct A { };

template <unsigned N>
  unsigned f(const A (& aa)[N])  { return N; }

int main()
{
  A aa[3];
  typedef const A (& CAR)[3];
  return f(static_cast<CAR>(aa)) != 3 || f((CAR)aa) != 3;
}
-----------------------

Nathan Myers
ncm@cantrip.org


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