[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Sema / gnu-asm-pmf.cpp
blob3758dbc992da97016c4497dae671d6a4450fe6f9
1 // RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -std=c++23 -fsyntax-only %s -verify
2 // RUN: %clang_cc1 -triple x86_64-unknown-windows-itanium -std=c++23 -fsyntax-only %s -verify
4 struct S {
5 void operator()();
6 };
8 struct T {
9 virtual void operator()();
12 struct U {
13 static void operator()();
16 struct V: virtual T {
17 virtual void f();
20 struct W : virtual V {
21 int i;
24 struct X {
25 __UINTPTR_TYPE__ ptr;
26 __UINTPTR_TYPE__ adj;
29 auto L = [](){};
31 void f() {
32 auto pmf = &S::operator();
34 __asm__ __volatile__ ("" : : "r"(&decltype(L)::operator()));
35 // expected-error@-1{{cannot pass a pointer-to-member through register-constrained inline assembly parameter}}
36 __asm__ __volatile__ ("" : : "r"(&S::operator()));
37 // expected-error@-1{{cannot pass a pointer-to-member through register-constrained inline assembly parameter}}
38 __asm__ __volatile__ ("" : : "r"(&T::operator()));
39 // expected-error@-1{{cannot pass a pointer-to-member through register-constrained inline assembly parameter}}
40 __asm__ __volatile__ ("" : : "r"(pmf));
41 // expected-error@-1{{cannot pass a pointer-to-member through register-constrained inline assembly parameter}}
42 __asm__ __volatile__ ("" : : "r"(&W::f));
43 // expected-error@-1{{cannot pass a pointer-to-member through register-constrained inline assembly parameter}}
44 __asm__ __volatile__ ("" : : "r"(&W::i));
45 // expected-error@-1{{cannot pass a pointer-to-member through register-constrained inline assembly parameter}}
47 __asm__ __volatile__ ("" : : "r"(X{0,0}));
48 __asm__ __volatile__ ("" : : "r"(&U::operator()));