diff options
author | Serge Pavlov <sepavloff@gmail.com> | 2017-07-26 14:58:55 +0000 |
---|---|---|
committer | Serge Pavlov <sepavloff@gmail.com> | 2017-07-26 14:58:55 +0000 |
commit | 8861b18d9b4262849f58ccf5eec2133f7fc994cc (patch) | |
tree | 504b65abc54937e1af97bec04303f788035a5b74 /test/SemaTemplate/instantiate-friend-function.cpp | |
parent | 30f32e2463a9cc6ea3f4b21013b876912d5a5d53 (diff) | |
download | clang-8861b18d9b4262849f58ccf5eec2133f7fc994cc.tar.gz |
Regression test for PR10856
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309118 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/instantiate-friend-function.cpp')
-rw-r--r-- | test/SemaTemplate/instantiate-friend-function.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/test/SemaTemplate/instantiate-friend-function.cpp b/test/SemaTemplate/instantiate-friend-function.cpp new file mode 100644 index 0000000000..08602d522d --- /dev/null +++ b/test/SemaTemplate/instantiate-friend-function.cpp @@ -0,0 +1,49 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s +// RUN: %clang_cc1 -S -triple %itanium_abi_triple -std=c++11 -emit-llvm %s -o - | FileCheck %s +// expected-no-diagnostics + +namespace PR10856 { + template<typename T> class C; + + template<typename S, typename R = S> C<R> operator - (C<S> m0, C<S> m1); + template<typename T> class C { + public: + template<typename S, typename R> friend C<R> operator - (C<S> m0, C<S> m1); + }; + + template<typename S, typename R> inline C<R> operator - (C<S> m0, C<S> m1) { + C<R> ret; + return ret; + } +}; + +int PR10856_main(int argc, char** argv) { + using namespace PR10856; + C<int> a; + a-a; + return 0; +} + +// PR10856::C<int> PR10856::operator-<int, int>(PR10856::C<int>, PR10856::C<int>) +// CHECK: define {{.*}} @_ZN7PR10856miIiiEENS_1CIT0_EENS1_IT_EES5_ + +namespace PR10856_Root { + template<typename Value, typename Defaulted = void> + bool g(Value value); + + template<typename ClassValue> class MyClass { + private: + template<typename Value, typename Defaulted> + friend bool g(Value value); + }; +} + +namespace PR10856_Root { + void f() { + MyClass<int> value; + g(value); + } +} + +// bool PR10856_Root::g<PR10856_Root::MyClass<int>, void>(PR10856_Root::MyClass<int>) +// CHECK: call {{.*}} @_ZN12PR10856_Root1gINS_7MyClassIiEEvEEbT_ |