summaryrefslogtreecommitdiff
path: root/test/SemaTemplate
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaTemplate')
-rw-r--r--test/SemaTemplate/class-template-ctor-initializer.cpp33
-rw-r--r--test/SemaTemplate/operator-template.cpp6
-rw-r--r--test/SemaTemplate/recursive-template-instantiation.cpp10
3 files changed, 47 insertions, 2 deletions
diff --git a/test/SemaTemplate/class-template-ctor-initializer.cpp b/test/SemaTemplate/class-template-ctor-initializer.cpp
new file mode 100644
index 0000000000000..d7649f52688db
--- /dev/null
+++ b/test/SemaTemplate/class-template-ctor-initializer.cpp
@@ -0,0 +1,33 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+template<class X> struct A {};
+
+template<class X> struct B : A<X> {
+ B() : A<X>() {}
+};
+B<int> x;
+
+template<class X> struct B1 : A<X> {
+ typedef A<X> Base;
+ B1() : Base() {}
+};
+B1<int> x1;
+
+
+template<typename T> struct Tmpl { };
+
+template<typename T> struct TmplB { };
+
+struct TmplC : Tmpl<int> {
+ TmplC() :
+ Tmpl<int>(),
+ TmplB<int>() { } // expected-error {{type 'TmplB<int>' is not a direct or virtual base of 'TmplC'}}
+};
+
+
+struct TmplD : Tmpl<char>, TmplB<char> {
+ TmplD():
+ Tmpl<int>(), // expected-error {{type 'Tmpl<int>' is not a direct or virtual base of 'TmplD'}}
+ TmplB<char>() {}
+};
+
diff --git a/test/SemaTemplate/operator-template.cpp b/test/SemaTemplate/operator-template.cpp
index 3d041ec13a329..7039e0ec83de4 100644
--- a/test/SemaTemplate/operator-template.cpp
+++ b/test/SemaTemplate/operator-template.cpp
@@ -5,10 +5,12 @@ template<class X>struct A{typedef X Y;};
template<class X>bool operator==(A<X>,typename A<X>::Y);
int a(A<int> x) { return operator==(x,1); }
-// FIXME: The diagnostic here is a bit messed up
+int a0(A<int> x) { return x == 1; }
+
+// FIXME: the location information for the note isn't very good
template<class X>struct B{typedef X Y;};
template<class X>bool operator==(B<X>*,typename B<X>::Y); // \
expected-error{{overloaded 'operator==' must have at least one parameter of class or enumeration type}} \
-expected-note{{in instantiation of default argument for 'operator==<int>' required here}}
+expected-note{{in instantiation of member function}}
int a(B<int> x) { return operator==(&x,1); }
diff --git a/test/SemaTemplate/recursive-template-instantiation.cpp b/test/SemaTemplate/recursive-template-instantiation.cpp
new file mode 100644
index 0000000000000..7c88d5019fd51
--- /dev/null
+++ b/test/SemaTemplate/recursive-template-instantiation.cpp
@@ -0,0 +1,10 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+template<typename T> void f(T* t) {
+ f(*t); // expected-error{{no matching function}}\
+ // expected-note 3{{requested here}}
+}
+
+void test_f(int ****p) {
+ f(p); // expected-note{{requested here}}
+}