[cfe-dev] Pointer Arithmetic

Chris Lattner clattner at apple.com
Thu Jul 12 08:46:59 PDT 2007


On Jul 12, 2007, at 4:56 AM, Keith Bauer wrote:

> After further reflection, I've realized that the test
>
> if (isa<PointerType>(ExprTy)) {
>
> in
>
> case BinaryOperator::Sub
>
> should not detect (pointer - pointer), since the type of that
> expression should be integral (ptrdiff_t).  However, it *is* detecting
> (pointer - pointer), which is causing at least one of the problems I
> had with implementing it...
>
> Where is that expression's type coming from?

This looks like a bug in the semantic analyzer for -.  Take a look at  
Sema/SemaExpr.cpp:819.

-Chris



More information about the cfe-dev mailing list