xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/call-with-static-chain.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s
2*0a6a1f1dSLionel Sambuc 
3*0a6a1f1dSLionel Sambuc int &f();
4*0a6a1f1dSLionel Sambuc 
5*0a6a1f1dSLionel Sambuc struct A {
6*0a6a1f1dSLionel Sambuc   void f();
7*0a6a1f1dSLionel Sambuc };
8*0a6a1f1dSLionel Sambuc 
9*0a6a1f1dSLionel Sambuc typedef int I;
10*0a6a1f1dSLionel Sambuc 
g()11*0a6a1f1dSLionel Sambuc void g() {
12*0a6a1f1dSLionel Sambuc   __builtin_call_with_static_chain(f(), f) = 42;
13*0a6a1f1dSLionel Sambuc   __builtin_call_with_static_chain(A().f(), f); // expected-error {{first argument to __builtin_call_with_static_chain must be a non-member call expression}}
14*0a6a1f1dSLionel Sambuc   __builtin_call_with_static_chain((42).~I(), f); // expected-error {{first argument to __builtin_call_with_static_chain must not be a pseudo-destructor call}}
15*0a6a1f1dSLionel Sambuc }
16