[PATCH] D151553: [clang] Fix consteval operators in template contexts
Corentin Jabot via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 7 04:04:37 PDT 2023
cor3ntin added inline comments.
================
Comment at: clang/lib/Sema/TreeTransform.h:15216-15217
- if (Op == OO_Subscript) {
- SourceLocation LBrace;
- SourceLocation RBrace;
-
- if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Callee)) {
- DeclarationNameLoc NameLoc = DRE->getNameInfo().getInfo();
- LBrace = NameLoc.getCXXOperatorNameBeginLoc();
- RBrace = NameLoc.getCXXOperatorNameEndLoc();
- } else {
- LBrace = Callee->getBeginLoc();
- RBrace = OpLoc;
- }
-
- return SemaRef.CreateOverloadedArraySubscriptExpr(LBrace, RBrace,
- First, Second);
- }
+ // FIXME: The following code for subscript expression is either never executed
+ // or not tested by check-clang.
+ if (Op == OO_Subscript)
----------------
Fznamznon wrote:
> cor3ntin wrote:
> > Maybe it would be worth investigating that further before merging the PR? Although the pr is a clear improvement so I'll let you decide what to do!
> I've noticed that it is likely a dead code, so I didn't want to pass more parameters to `RebuildCXXOperatorCallExpr` in order to support dead code, but didn't feel confident enough to remove it. So I left this FIXME.
> `RebuildCXXOperatorCallExpr` is only called by `TransformCXXOperatorCallExpr` and `TransformCXXFoldExpr`. When subscript expression comes to `TransformCXXOperatorCallExpr`, it never falls down to `RebuildCXXOperatorCallExpr` after c1512250960bd247519a9f959ad4af202402dcc4 , and I don't think that it is possible to have subscript expression as a part of a fold expression. So, for me, it seems the whole `if` and FIXME actually can be removed. WDYT?
>
I think you are right, It's seems like something I should have done as part of rGc1512250960bd247519a9f959ad4af202402dcc4.
It think you should remove it. (if we break something we can put it back with tests!)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D151553/new/
https://reviews.llvm.org/D151553
More information about the cfe-commits
mailing list