summaryrefslogtreecommitdiff
path: root/clang/test/CXX/temp/temp.decls/temp.friend/p4.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/CXX/temp/temp.decls/temp.friend/p4.cpp')
-rw-r--r--clang/test/CXX/temp/temp.decls/temp.friend/p4.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/clang/test/CXX/temp/temp.decls/temp.friend/p4.cpp b/clang/test/CXX/temp/temp.decls/temp.friend/p4.cpp
new file mode 100644
index 0000000..e036cef
--- /dev/null
+++ b/clang/test/CXX/temp/temp.decls/temp.friend/p4.cpp
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+template<typename T>
+struct X1 {
+ friend void f6(int) { } // expected-error{{redefinition of}} \
+ // expected-note{{previous definition}}
+};
+
+X1<int> x1a;
+X1<float> x1b; // expected-note {{in instantiation of}}
+
+template<typename T>
+struct X2 {
+ operator int();
+
+ friend void f(int x) { } // expected-error{{redefinition}} \
+ // expected-note{{previous definition}}
+};
+
+int array0[sizeof(X2<int>)];
+int array1[sizeof(X2<float>)]; // expected-note{{instantiation of}}
+
+void g() {
+ X2<int> xi;
+ f(xi);
+ X2<float> xf;
+ f(xf);
+}