summaryrefslogtreecommitdiff
path: root/test/SemaCXX/nested-name-spec-locations.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2011-02-26 22:09:03 +0000
committerDimitry Andric <dim@FreeBSD.org>2011-02-26 22:09:03 +0000
commitc3b054d250cdca485c71845089c316e10610ebad (patch)
treeabae0246ec9156cc1a7cbb947b2b0dfe95fa3189 /test/SemaCXX/nested-name-spec-locations.cpp
parentbca07a4524feb4edec581062d631a13116320a24 (diff)
Diffstat (limited to 'test/SemaCXX/nested-name-spec-locations.cpp')
-rw-r--r--test/SemaCXX/nested-name-spec-locations.cpp70
1 files changed, 70 insertions, 0 deletions
diff --git a/test/SemaCXX/nested-name-spec-locations.cpp b/test/SemaCXX/nested-name-spec-locations.cpp
new file mode 100644
index 0000000000000..25914df627bdb
--- /dev/null
+++ b/test/SemaCXX/nested-name-spec-locations.cpp
@@ -0,0 +1,70 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// Note: the formatting in this test case is intentionally funny, with
+// nested-name-specifiers stretched out vertically so that we can
+// match up diagnostics per-line and still verify that we're getting
+// good source-location information.
+
+namespace outer {
+ namespace inner {
+ template<typename T>
+ struct X0 {
+ };
+ }
+}
+
+template<typename T>
+struct add_reference {
+ typedef T& type;
+};
+
+namespace outer_alias = outer;
+
+template<typename T>
+struct UnresolvedUsingValueDeclTester {
+ using outer::inner::X0<
+ typename add_reference<T>::type
+ * // expected-error{{declared as a pointer to a reference of type}}
+ >::value;
+};
+
+UnresolvedUsingValueDeclTester<int> UnresolvedUsingValueDeclCheck; // expected-note{{in instantiation of template class}}
+
+template<typename T>
+struct UnresolvedUsingTypenameDeclTester {
+ using outer::inner::X0<
+ typename add_reference<T>::type
+ * // expected-error{{declared as a pointer to a reference of type}}
+ >::value;
+};
+
+UnresolvedUsingTypenameDeclTester<int> UnresolvedUsingTypenameDeclCheck; // expected-note{{in instantiation of template class}}
+
+
+template<typename T, typename U>
+struct PseudoDestructorExprTester {
+ void f(T *t) {
+ t->T::template Inner<typename add_reference<U>::type
+ * // expected-error{{as a pointer to a reference of type}}
+ >::Blarg::~Blarg();
+ }
+};
+
+struct HasInnerTemplate {
+ template<typename T>
+ struct Inner;
+
+ typedef HasInnerTemplate T;
+};
+
+void PseudoDestructorExprCheck(
+ PseudoDestructorExprTester<HasInnerTemplate, float> tester) {
+ tester.f(0); // expected-note{{in instantiation of member function}}
+}
+
+template<typename T>
+struct DependentScopedDeclRefExpr {
+ void f() {
+ outer_alias::inner::X0<T>::value = 17;
+ }
+};