summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/temp/temp.decls/temp.friend/p1.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/CXX/temp/temp.decls/temp.friend/p1.cpp')
-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