[PATCH] D156794: [clang][Interp] Lazily visit unknown global declarations

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 2 06:20:24 PDT 2023


aaron.ballman added inline comments.


================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:2172-2173
 
+  // Lazily visit global declarations we haven't seen yet.
+  // This happens in C.
+  if (const auto *VD = dyn_cast<VarDecl>(D);
----------------
Do we want to assert/limit this functionality to C instead of doing it in both C and C++?


================
Comment at: clang/test/AST/Interp/c.c:15-16
+
+const int b = 3;
+_Static_assert(b == 3, "");
----------------
Pedantically, this is also not a constant expression. Probably worth adding `-pedantic` to the RUN lines to ensure we properly warn with both constexpr engines.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156794/new/

https://reviews.llvm.org/D156794



More information about the cfe-commits mailing list