From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- clang/test/SemaTemplate/friend.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 clang/test/SemaTemplate/friend.cpp (limited to 'clang/test/SemaTemplate/friend.cpp') diff --git a/clang/test/SemaTemplate/friend.cpp b/clang/test/SemaTemplate/friend.cpp new file mode 100644 index 0000000..e78a067 --- /dev/null +++ b/clang/test/SemaTemplate/friend.cpp @@ -0,0 +1,33 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +template struct A { + struct B { }; + + friend struct B; +}; + +void f() { + A::B b; +} + +struct C0 { + friend struct A; +}; + +namespace PR6770 { + namespace N { + int f1(int); + } + using namespace N; + + namespace M { + float f1(float); + } + using M::f1; + + template void f1(T, T); + template + void f() { + friend class f; // expected-error{{'friend' used outside of class}} + friend class f1; // expected-error{{'friend' used outside of class}} + } +} -- cgit v1.2.3