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