| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 |
// expected-no-diagnostics |
| 3 |
|
| 4 |
// Make sure that friend declarations don't introduce ambiguous |
| 5 |
// declarations. |
| 6 |
|
| 7 |
// Test case courtesy of Shantonu Sen. |
| 8 |
// Bug 4784. |
| 9 |
|
| 10 |
class foo; |
| 11 |
|
| 12 |
extern "C" { |
| 13 |
int c_func(foo *a); |
| 14 |
}; |
| 15 |
int cpp_func(foo *a); |
| 16 |
|
| 17 |
class foo { |
| 18 |
public: |
| 19 |
friend int c_func(foo *a); |
| 20 |
friend int cpp_func(foo *a); |
| 21 |
int caller(); |
| 22 |
private: |
| 23 |
int x; |
| 24 |
}; |
| 25 |
|
| 26 |
int c_func(foo *a) { |
| 27 |
return a->x; |
| 28 |
} |
| 29 |
|
| 30 |
int cpp_func(foo *a) { |
| 31 |
return a->x; |
| 32 |
} |
| 33 |
|
| 34 |
int foo::caller() { |
| 35 |
c_func(this); |
| 36 |
cpp_func(this); |
| 37 |
return 0; |
| 38 |
} |