[PATCH] D142490: [Clang] Fix ClassifyImplicitMemberAccess to handle cases where the access in an unevaluated context is not within a CXXRecordDecl or CXXMethodDecl

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 14 14:03:03 PDT 2023


shafik added inline comments.


================
Comment at: clang/test/SemaCXX/statements.cpp:60-61
+    int i;
+    int j = ({i;}); // expected-error {{invalid use of non-static data member 'i'}}
+                    // expected-error at -1 {{cannot initialize a member subobject of type 'int' with an rvalue of type 'void'}}
+		    // expected-warning at -2 {{use of GNU statement expression extension}}
----------------
aaron.ballman wrote:
> This diagnostic isn't entirely unreasonable, but I think GCC gives a better diagnostic: https://godbolt.org/z/T4dbhnoo7
Yeah, probably worth filing a bug for this after I land this.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142490/new/

https://reviews.llvm.org/D142490



More information about the cfe-commits mailing list