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