1 // 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 9 class foo; 10 11 extern "C" { 12 int c_func(foo *a); 13 }; 14 int cpp_func(foo *a); 15 16 class foo { 17 public: 18 friend int c_func(foo *a); 19 friend int cpp_func(foo *a); 20 int caller(); 21 private: 22 int x; 23 }; 24 25 int c_func(foo *a) { 26 return a->x; 27 } 28 29 int cpp_func(foo *a) { 30 return a->x; 31 } 32 33 int foo::caller() { 34 c_func(this); 35 cpp_func(this); 36 return 0; 37 } 38