aboutsummaryrefslogtreecommitdiff
path: root/test/SemaTemplate/default-arguments-cxx0x.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-11-25 18:55:14 +0000
committerDouglas Gregor <dgregor@apple.com>2009-11-25 18:55:14 +0000
commit51ffb0c9d43b2d3fd210e51ecdd67ba5d1790d70 (patch)
treeb54f10a7404e78f0acec5514b3c70a0c0d13c704 /test/SemaTemplate/default-arguments-cxx0x.cpp
parent5b6d70e2dece713de82612ffbac2f2bc5c367f73 (diff)
Implement support for default template arguments of function templates.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89874 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/default-arguments-cxx0x.cpp')
-rw-r--r--test/SemaTemplate/default-arguments-cxx0x.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/SemaTemplate/default-arguments-cxx0x.cpp b/test/SemaTemplate/default-arguments-cxx0x.cpp
new file mode 100644
index 0000000000..8d8833c670
--- /dev/null
+++ b/test/SemaTemplate/default-arguments-cxx0x.cpp
@@ -0,0 +1,26 @@
+// RUN: clang-cc -fsyntax-only -std=c++0x -verify %s
+
+// Test default template arguments for function templates.
+template<typename T = int>
+void f0();
+
+template<typename T>
+void f0();
+
+void g0() {
+ f0(); // okay!
+}
+
+template<typename T, int N = T::value>
+int &f1(T);
+
+float &f1(...);
+
+struct HasValue {
+ static const int value = 17;
+};
+
+void g1() {
+ float &fr = f1(15);
+ int &ir = f1(HasValue());
+}