| 1 |
// RUN: %clang_cc1 -verify -std=c++2c %s |
| 2 |
// RUN: cp %s %t |
| 3 |
// RUN: not %clang_cc1 -x c++ -std=c++2c -fixit %t |
| 4 |
// RUN: %clang_cc1 -x c++ -std=c++2c %t |
| 5 |
// RUN: not %clang_cc1 -std=c++2c -x c++ -fsyntax-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s |
| 6 |
struct S { |
| 7 |
void f(this S); |
| 8 |
void g() { |
| 9 |
(void)&f; // expected-error {{must explicitly qualify name of member function when taking its address}} |
| 10 |
// CHECK: fix-it:{{.*}}:{9:16-9:16}:"S::" |
| 11 |
} |
| 12 |
}; |
| 13 |
|
| 14 |
struct S2 { |
| 15 |
void f(this S2 foo) { |
| 16 |
g(); // expected-error {{call to non-static member function without an object argument}} |
| 17 |
// CHECK: fix-it:{{.*}}:{16:9-16:9}:"foo." |
| 18 |
|
| 19 |
h(); // expected-error {{call to explicit member function without an object argument}} |
| 20 |
// CHECK: fix-it:{{.*}}:{19:9-19:9}:"foo." |
| 21 |
|
| 22 |
i(); |
| 23 |
|
| 24 |
var; // expected-error {{invalid use of member 'var' in explicit object member function}} |
| 25 |
// CHECK: fix-it:{{.*}}:{24:9-24:9}:"foo." |
| 26 |
|
| 27 |
} |
| 28 |
void g(); |
| 29 |
void h(this S2 s); |
| 30 |
static void i(); |
| 31 |
int var; |
| 32 |
}; |