Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CXX / class / class.friend / p1-ambiguous.cpp
blob3bb32718361d547ddbed4e0136564a6083c87945
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // expected-no-diagnostics
4 // Make sure that friend declarations don't introduce ambiguous
5 // declarations.
7 // Test case courtesy of Shantonu Sen.
8 // Bug 4784.
10 class foo;
12 extern "C" {
13 int c_func(foo *a);
15 int cpp_func(foo *a);
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;
26 int c_func(foo *a) {
27 return a->x;
30 int cpp_func(foo *a) {
31 return a->x;
34 int foo::caller() {
35 c_func(this);
36 cpp_func(this);
37 return 0;