xref: /llvm-project/clang/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p8.cpp (revision 40ea01f6543d0d4aa2701d1b27a6c5413340e7d5)
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 class A {
f(A * p=this)3   void f(A* p = this) { }	// expected-error{{invalid use of 'this'}}
4 
5   void test();
6 };
7 
test()8 void A::test() {
9   void g(int = this);
10   // expected-error@-1 {{cannot initialize a parameter of type 'int' with an rvalue of type 'A *'}}
11   // expected-note@-2 {{passing argument to parameter here}}
12 
13   void h(int = ((void)this,42));
14   // expected-error@-1 {{default argument references 'this'}}
15 }
16