[clang-tools-extra] [clang-tidy] fix bugprone-sizeof-expression when sizeof expression with template types (PR #115275)

Julian Schmidt via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 9 14:32:40 PST 2024


================
@@ -385,3 +385,8 @@ int ValidExpressions() {
   sum += sizeof(PtrArray) / sizeof(A[0]);
   return sum;
 }
+
+template<class T>
+int ValidateTemplateTypeExpressions(T t) {
+  return sizeof(t.val) / sizeof(t.val[0]);
+}
----------------
5chmidti wrote:

Please note the issue somewhere on this test-case (115175) (e.g. namespace)

https://github.com/llvm/llvm-project/pull/115275


More information about the cfe-commits mailing list