Debian Codegraph @

clang/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p8.cpp

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