[clang] [Clang] Fix missing diagnostic for non-standard layout type in `offsetof` (PR #65246)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 5 07:28:08 PDT 2023
================
@@ -17,7 +17,7 @@ struct Base { int x; };
struct Derived : Base { int y; };
int o = __builtin_offsetof(Derived, x); // expected-warning{{offset of on non-POD type}}
-const int o2 = sizeof(__builtin_offsetof(Derived, x));
+const int o2 = sizeof(__builtin_offsetof(Derived, x)); // expected-warning{{offset of on non-POD type 'Derived'}}
----------------
cor3ntin wrote:
So you think we should ie, check for `!isUnevaluated()` - ie diag in constant expressions but not in unevaluated contexts?
https://github.com/llvm/llvm-project/pull/65246
More information about the cfe-commits
mailing list