================ @@ -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:
> I think creating an issue, or a new PR is the way to go. Would that work for > you? Yes. Issue made: #90822. I will create PR in a few days. 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