shafik added inline comments.
================
Comment at: clang/lib/AST/Interp/Interp.cpp:101
+static bool CheckConstexpr(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
+ if (!S.inConstantContext())
----------------
Is `CheckConstexpr` descriptive enough? Would something like `CheckLoadIsValid`
be better?
================
Comment at: clang/lib/AST/Interp/Interp.cpp:110
+ if (auto *VarD = dyn_cast<VarDecl>(VD)) {
+ if (VarD->hasLocalStorage() || VarD->isConstexpr())
+ return true;
----------------
Is this sufficient? How about something like this:
```
int *p;
int constexpr f(int &x) {
*p=1;
return 10;
}
```
Maybe I am not understanding. I think more test case would be useful.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137563/new/
https://reviews.llvm.org/D137563
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits