[clang] [clang] Fix constant evaluation of member pointer access into sibling class. (PR #150829)

Justin Stitt via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 5 14:43:09 PDT 2025


================
@@ -43,6 +43,26 @@ C++ Specific Potentially Breaking Changes
   regressions if your build system supports two-phase compilation model but haven't support
   reduced BMI or it is a compiler bug or a bug in users code.
 
+- Clang now correctly diagnoses during constant expression evaluation undefined behavior due to member
+  pointer access to a member which is not a direct or indirect member of the most-derived object
+  of the accessed object but is instead located directly in a sibling class to one of the classes
+  along the inheritance hierarchy of the most-derived object as ill-formed.
+  Other scenarios in which the member is not member of the most derived object were already
+  diagnosed previously. (#GH150709)
----------------
JustinStitt wrote:

Thanks for adding a release note. I am fine with how this paragraph is written but I must say that first run-on sentence reminded me of [this short video](https://www.youtube.com/watch?v=G7RgN9ijwE4&pp=0gcJCfwAo7VqN5tD) 😅

The handling of the member pointer access looks good and the tests look great. LGTM.

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


More information about the cfe-commits mailing list