summaryrefslogtreecommitdiffstats
path: root/test/SemaTemplate/friend-template.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaTemplate/friend-template.cpp')
-rw-r--r--test/SemaTemplate/friend-template.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/test/SemaTemplate/friend-template.cpp b/test/SemaTemplate/friend-template.cpp
index 9c95fa0..9acbfdc 100644
--- a/test/SemaTemplate/friend-template.cpp
+++ b/test/SemaTemplate/friend-template.cpp
@@ -243,3 +243,62 @@ namespace rdar11147355 {
A<double>::B<double> ab;
}
+
+namespace RedeclUnrelated {
+ struct S {
+ int packaged_task;
+ template<typename> class future {
+ template<typename> friend class packaged_task;
+ };
+ future<void> share;
+ };
+}
+
+namespace PR12557 {
+ template <typename>
+ struct Foo;
+
+ template <typename Foo_>
+ struct Bar {
+ typedef Foo_ Foo; // expected-note {{previous}}
+
+ template <typename> friend struct Foo; // expected-error {{redefinition of 'Foo' as different kind of symbol}}
+ };
+
+ Bar<int> b;
+}
+
+namespace PR12585 {
+ struct A { };
+ template<typename> struct B {
+ template<typename> friend class A::does_not_exist; // \
+ // expected-error {{friend declaration of 'does_not_exist' does not match any declaration in 'PR12585::A'}}
+ };
+
+ struct C {
+ template<typename> struct D;
+ };
+ template<typename> class E {
+ int n;
+ template<typename> friend struct C::D;
+ };
+ template<typename T> struct C::D {
+ int f() {
+ return E<int>().n;
+ }
+ };
+ int n = C::D<void*>().f();
+
+ struct F {
+ template<int> struct G;
+ };
+ template<typename T> struct H {
+ // FIXME: As with cases above, the note here is on an unhelpful declaration,
+ // and should point to the declaration of G within F.
+ template<T> friend struct F::G; // \
+ // expected-error {{different type 'char' in template redeclaration}} \
+ // expected-note {{previous}}
+ };
+ H<int> h1; // ok
+ H<char> h2; // expected-note {{instantiation}}
+}
OpenPOWER on IntegriCloud