summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-08-14 02:03:10 +0000
committerJohn McCall <rjmccall@apple.com>2009-08-14 02:03:10 +0000
commit58de35804b75f016d485d92f0ebd0de75af51bd2 (patch)
tree60ff7a14fe5ed9f52a21e84f3dc8706b6816afde /clang/test/CXX
parentdc1869661b73eb5ad78ef8edad5aa4488f598e50 (diff)
downloadbcm5719-llvm-58de35804b75f016d485d92f0ebd0de75af51bd2.tar.gz
bcm5719-llvm-58de35804b75f016d485d92f0ebd0de75af51bd2.zip
Support friend declarations in templates and test that argdep lookup
still works. llvm-svn: 78979
Diffstat (limited to 'clang/test/CXX')
-rw-r--r--clang/test/CXX/temp/temp.decls/temp.friend/p1.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/CXX/temp/temp.decls/temp.friend/p1.cpp b/clang/test/CXX/temp/temp.decls/temp.friend/p1.cpp
new file mode 100644
index 00000000000..90174585cc8
--- /dev/null
+++ b/clang/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();
+}
OpenPOWER on IntegriCloud