diff options
author | Yaron Keren <yaron.keren@gmail.com> | 2017-04-17 08:51:20 +0000 |
---|---|---|
committer | Yaron Keren <yaron.keren@gmail.com> | 2017-04-17 08:51:20 +0000 |
commit | eb26f1e4a82d9e76c643e9253115a364e508610b (patch) | |
tree | b68c8f3410e885ebaaa0ccd5cdf9ba4fb551fdd5 /test/SemaTemplate | |
parent | 7b2a25cbbdb9d8495c576f86739d13cd055260de (diff) |
Address http://bugs.llvm.org/pr30994 so that a non-friend can properly replace a friend, and a visible friend can properly replace an invisible friend but not vice verse, and definitions are not replaced. This fixes the two FIXME in SemaTemplate/friend-template.cpp.
The code implements Richard Smith suggestion in comment 3 of the PR.
reviewer: Vassil Vassilev
Differential Revision: https://reviews.llvm.org/D31540
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300443 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate')
-rw-r--r-- | test/SemaTemplate/friend-template.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/test/SemaTemplate/friend-template.cpp b/test/SemaTemplate/friend-template.cpp index e9b2b9b8e6..1ed751b4f3 100644 --- a/test/SemaTemplate/friend-template.cpp +++ b/test/SemaTemplate/friend-template.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s // PR5057 namespace test0 { namespace std { @@ -68,17 +68,12 @@ namespace test3 { Foo<int> foo; template<typename T, T Value> struct X2a; - - template<typename T, int Size> struct X2b; + template<typename T, int Size> struct X2b; // expected-note {{previous non-type template parameter with type 'int' is here}} template<typename T> class X3 { template<typename U, U Value> friend struct X2a; - - // FIXME: the redeclaration note ends up here because redeclaration - // lookup ends up finding the friend target from X3<int>. - template<typename U, T Value> friend struct X2b; // expected-error {{template non-type parameter has a different type 'long' in template redeclaration}} \ - // expected-note {{previous non-type template parameter with type 'int' is here}} + template<typename U, T Value> friend struct X2b; // expected-error {{template non-type parameter has a different type 'long' in template redeclaration}} }; X3<int> x3i; // okay @@ -297,14 +292,11 @@ namespace PR12585 { int n = C::D<void*>().f(); struct F { - template<int> struct G; + template<int> struct G; // expected-note {{previous}} }; 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}} + // expected-error {{different type 'char' in template redeclaration}} }; H<int> h1; // ok H<char> h2; // expected-note {{instantiation}} @@ -329,3 +321,11 @@ namespace rdar12350696 { foo(b); // expected-note {{in instantiation}} } } +namespace PR30994 { + void f(); + struct A { + [[deprecated]] friend void f() {} // \ + expected-note {{has been explicitly marked deprecated here}} + }; + void g() { f(); } // expected-warning {{is deprecated}} +} |