diff options
author | John McCall <rjmccall@apple.com> | 2009-08-14 02:03:10 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2009-08-14 02:03:10 +0000 |
commit | fd810b1386ed29b250e7d522ea826a65c815e49d (patch) | |
tree | 303aa97b6aade9df7395a00ca908434d028661a5 /test/CXX/temp | |
parent | 929742338206eec29caa7c20e3c484cc79f18240 (diff) |
Support friend declarations in templates and test that argdep lookup
still works.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78979 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX/temp')
-rw-r--r-- | test/CXX/temp/temp.decls/temp.friend/p1.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/CXX/temp/temp.decls/temp.friend/p1.cpp b/test/CXX/temp/temp.decls/temp.friend/p1.cpp new file mode 100644 index 0000000000..90174585cc --- /dev/null +++ b/test/CXX/temp/temp.decls/temp.friend/p1.cpp @@ -0,0 +1,20 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +template <typename T> class Num { + T value_; + +public: + Num(T value) : value_(value) {} + T get() const { return value_; } + + friend Num operator+(const Num &a, const Num &b) { + return a.value_ + b.value_; + } +}; + +int main() { + Num<int> left = -1; + Num<int> right = 1; + Num<int> result = left + right; + return result.get(); +} |