[PATCH] D137240: [clang][Interp] Support alignof()

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 2 12:25:55 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:444
+    //     alignment of the referenced type.
+    if (const ReferenceType *Ref = ArgType->getAs<ReferenceType>())
+      ArgType = Ref->getPointeeType();
----------------
You're missing the rest of the standards quote from http://eel.is/c++draft/expr.alignof#3. There is some logic missing here for array types. Getting the alignment of an array gives you the alignment of its element type. (And there don't seem to be any tests for calling alignof on an array, so we should add some.)


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

https://reviews.llvm.org/D137240



More information about the cfe-commits mailing list