summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/temp/temp.spec/temp.expl.spec/p20.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-10-13 14:39:41 +0000
committerDouglas Gregor <dgregor@apple.com>2009-10-13 14:39:41 +0000
commit3a88c1d784d818afbcec58af6b4a44678ae09d00 (patch)
tree880a7a14d0eadfcc0aae1732a03af6b555982111 /clang/test/CXX/temp/temp.spec/temp.expl.spec/p20.cpp
parent87876a00537f7be696cc34f516da268bb8de4397 (diff)
downloadbcm5719-llvm-3a88c1d784d818afbcec58af6b4a44678ae09d00.tar.gz
bcm5719-llvm-3a88c1d784d818afbcec58af6b4a44678ae09d00.zip
Improve the internal representation and semantic analysis of friend
function templates. This commit ensures that friend function templates are constructed as FunctionTemplateDecls rather than partial FunctionDecls (as they previously were). It then implements template instantiation for friend function templates, injecting the friend function template only when no previous declaration exists at the time of instantiation. Oh, and make sure that explicit specialization declarations are not friends. llvm-svn: 83970
Diffstat (limited to 'clang/test/CXX/temp/temp.spec/temp.expl.spec/p20.cpp')
-rw-r--r--clang/test/CXX/temp/temp.spec/temp.expl.spec/p20.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/test/CXX/temp/temp.spec/temp.expl.spec/p20.cpp b/clang/test/CXX/temp/temp.spec/temp.expl.spec/p20.cpp
new file mode 100644
index 00000000000..d270b8167a1
--- /dev/null
+++ b/clang/test/CXX/temp/temp.spec/temp.expl.spec/p20.cpp
@@ -0,0 +1,14 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+template<typename T>
+void f(T);
+
+template<typename T>
+struct A { };
+
+struct X {
+ template<> friend void f<int>(int); // expected-error{{in class scope}}
+ template<> friend class A<int>; // expected-error{{cannot be a friend}}
+
+ friend void f<float>(float); // okay
+ friend class A<float>; // okay
+};
OpenPOWER on IntegriCloud