================ @@ -0,0 +1,45 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=cplusplus -verify %s +// RUN: %clang_analyze_cc1 -analyzer-checker=cplusplus -verify %s -DEMPTY_CLASS + +// expected-no-diagnostics + +// This test reproduces the issue that previously the static analyzer +// initialized an [[__no_unique_address__]] empty field to zero, +// over-writing a non-empty field with the same offset. + +namespace std { +#ifdef EMPTY_CLASS + + template <typename T> + class default_delete { + T dump(); + static T x; + }; + template <class _Tp, class _Dp = default_delete<_Tp> > +#else + + struct default_delete {}; + template <class _Tp, class _Dp = default_delete > +#endif + class unique_ptr { + [[__no_unique_address__]] _Tp * __ptr_; ---------------- steakhal wrote:
It's not clear to me what test are you referring to. The GH actions appear to pass I think. I'd strongly argue that the C++ `[[no_uniqu_address]]` is a different thing to `[[msvc::no_uniqu_address]]` (which actually does nothing I believe to remain ABI compatible with old MSVC ABIs). Consequently, if this causes problems, we can test this code with pinned target triples to make assumptions about the ABI we test, and just run the test on linux and also on msvc triples. BTW, I was expecting the standard C++ attribute, spelled exactly as `[[no_uniqu_address]]`, why do you spell it `[[__no_uniqu_address__]]`, and how is this different to the standard spelling? https://github.com/llvm/llvm-project/pull/138594 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits