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