================ @@ -27,3 +26,20 @@ namespace rdar10544564 { X (Y::*func_mem_ptr1)() = &Y::memfunc1; X (Y::*func_mem_ptr2)() = &Y::memfunc2; } + +namespace test2 { + struct A { + int val; + void func() {} + }; + + void test() { + decltype(&(A::val)) ptr1; // expected-error {{invalid use of non-static data member 'val'}} + int A::* ptr2 = &(A::val); // expected-error {{invalid use of non-static data member 'val'}} + + // FIXME: Error messages in these cases are less than clear, we can do + // better. + int size = sizeof(&(A::func)); // expected-error {{call to non-static member function without an object argument}} + void (A::* ptr3)() = &(A::func); // expected-error {{call to non-static member function without an object argument}} ---------------- zwuis wrote:
> This inconsistency is irrelevant to issue 40906. I am confused about the > following questions: > > 1. Do I need to remove these tests? > 2. Do I need to fix this inconsistency in this PR, or a new PR? > 3. Should I open an issue for it? @cor3ntin Could you give me some ideas for these questions? Thank you! https://github.com/llvm/llvm-project/pull/89713 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits