16 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2class A { 3 void f(A* p = this) { } // expected-error{{invalid use of 'this'}}4 5 void test();6};7 8void 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