aboutsummaryrefslogtreecommitdiff
path: root/test/SemaTemplate/default-arguments.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-02-11 18:16:40 +0000
committerDouglas Gregor <dgregor@apple.com>2009-02-11 18:16:40 +0000
commit62cb18dd11472965e03374d40bc27d650bc331b6 (patch)
tree654a40f9c9f2cbe7baaa5e32496ddef569431851 /test/SemaTemplate/default-arguments.cpp
parent7151bbb55c8a437073e42f74348c3fd5f1d5b410 (diff)
Allow the use of default template arguments when forming a class
template specialization (e.g., std::vector<int> would now be well-formed, since it relies on a default argument for the Allocator template parameter). This is much less interesting than one might expect, since (1) we're not actually using the default arguments for anything important, such as naming an actual Decl, and (2) we'll often need to instantiate the default arguments to check their well-formedness. The real fun will come later. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64310 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/default-arguments.cpp')
-rw-r--r--test/SemaTemplate/default-arguments.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/SemaTemplate/default-arguments.cpp b/test/SemaTemplate/default-arguments.cpp
new file mode 100644
index 0000000000..94976e9735
--- /dev/null
+++ b/test/SemaTemplate/default-arguments.cpp
@@ -0,0 +1,13 @@
+// RUN: clang -fsyntax-only -verify %s
+
+template<typename T, int N = 2> struct X; // expected-note{{template is declared here}}
+
+X<int, 1> *x1;
+X<int> *x2;
+
+X<> *x3; // expected-error{{too few template arguments for class template 'X'}} \
+ // FIXME: expected-error{{expected unqualified-id}}
+
+template<typename U = float, int M> struct X;
+
+X<> *x4;