[clang] [Clang] Fix missing diagnostic for non-standard layout type in `offsetof` (PR #65246)

via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 4 01:56:07 PDT 2023


================
@@ -39,6 +40,4 @@ struct C {
 
 static_assert(__builtin_offsetof(C, n) == 8,
               "long long field in ms_struct should be 8-byte aligned");
-#if !defined(TEST_FOR_ERROR) && !defined(TEST_FOR_WARNING)
-// expected-no-diagnostics
-#endif
+// expected-warning at -2 {{offset of on non-standard-layout type 'C'}}
----------------
cor3ntin wrote:

We do not run clang-format on tests - in part because tests are sensible to line number changes.

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


More information about the cfe-commits mailing list