ABataev marked an inline comment as done.
ABataev added inline comments.

Comment at: clang/lib/Sema/SemaExpr.cpp:4751
+                                       LParenLoc, RParenLoc, Dims, Brackets);
+  if (!BaseTy->isAnyPointerType())
+    return ExprError(Diag(Base->getExprLoc(),
ABataev wrote:
> rjmccall wrote:
> > I think you should perform DefaultFunctionArrayLvalueConversion here so 
> > that e.g. arrays will decay to pointers, you load pointers from l-values, 
> > and so on.  If you do so, it'll handle placeholders for you.
> > 
> > Do you really want to allow this to operate on non-C pointer types?
> 1. Standard clearly states that the type of the base expression must be a 
> pointer. I don't think that we should perform implicit type casting here, 
> like decay to pointers, etc.
> 2. It is just a simple form of checking that this is a pointer type. Since 
> this expression is not allowed in other languages (and I filter it out at the 
> parsing stage), I think it is ok to use the generic form of type checking.
Forgot to mention, that I thought about possible conversion here. But it may 
lead to some unpredictable results, like:
int a[3];
Better to do not allow this kind of operation, I think.

  rG LLVM Github Monorepo



cfe-commits mailing list

Reply via email to