From 8861b18d9b4262849f58ccf5eec2133f7fc994cc Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Wed, 26 Jul 2017 14:58:55 +0000 Subject: Regression test for PR10856 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309118 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/SemaTemplate/instantiate-friend-function.cpp | 49 +++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 test/SemaTemplate/instantiate-friend-function.cpp (limited to 'test/SemaTemplate/instantiate-friend-function.cpp') 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 class C; + + template C operator - (C m0, C m1); + template class C { + public: + template friend C operator - (C m0, C m1); + }; + + template inline C operator - (C m0, C m1) { + C ret; + return ret; + } +}; + +int PR10856_main(int argc, char** argv) { + using namespace PR10856; + C a; + a-a; + return 0; +} + +// PR10856::C PR10856::operator-(PR10856::C, PR10856::C) +// CHECK: define {{.*}} @_ZN7PR10856miIiiEENS_1CIT0_EENS1_IT_EES5_ + +namespace PR10856_Root { + template + bool g(Value value); + + template class MyClass { + private: + template + friend bool g(Value value); + }; +} + +namespace PR10856_Root { + void f() { + MyClass value; + g(value); + } +} + +// bool PR10856_Root::g, void>(PR10856_Root::MyClass) +// CHECK: call {{.*}} @_ZN12PR10856_Root1gINS_7MyClassIiEEvEEbT_ -- cgit v1.2.1