diff options
author | John McCall <rjmccall@apple.com> | 2009-08-31 22:39:49 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2009-08-31 22:39:49 +0000 |
commit | 759e32bdc69968ec9ada4781b34894bb72fede43 (patch) | |
tree | 82008704a63ae44cfde4768312cfc13db16f3701 /clang/test/CXX/class | |
parent | 124095bb18fcd56e53d80a156199995096f3ff0f (diff) | |
download | bcm5719-llvm-759e32bdc69968ec9ada4781b34894bb72fede43.tar.gz bcm5719-llvm-759e32bdc69968ec9ada4781b34894bb72fede43.zip |
Fix bug 4784 and allow friend declarations to properly extend
existing declaration chains.
llvm-svn: 80636
Diffstat (limited to 'clang/test/CXX/class')
-rw-r--r-- | clang/test/CXX/class/class.friend/p1-ambiguous.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/clang/test/CXX/class/class.friend/p1-ambiguous.cpp b/clang/test/CXX/class/class.friend/p1-ambiguous.cpp new file mode 100644 index 00000000000..a02bc533752 --- /dev/null +++ b/clang/test/CXX/class/class.friend/p1-ambiguous.cpp @@ -0,0 +1,37 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +// Make sure that friend declarations don't introduce ambiguous +// declarations. + +// Test case courtesy of Shantonu Sen. +// Bug 4784. + +class foo; + +extern "C" { + int c_func(foo *a); +}; +int cpp_func(foo *a); + +class foo { +public: + friend int c_func(foo *a); + friend int cpp_func(foo *a); + int caller(); +private: + int x; +}; + +int c_func(foo *a) { + return a->x; +} + +int cpp_func(foo *a) { + return a->x; +} + +int foo::caller() { + c_func(this); + cpp_func(this); + return 0; +} |