aboutsummaryrefslogtreecommitdiff
path: root/test/SemaTemplate/instantiate-member-class.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-03-06 20:12:45 +0000
committerDouglas Gregor <dgregor@apple.com>2011-03-06 20:12:45 +0000
commiteff1dbec93999bfc5406eb861efd8add9de23633 (patch)
tree28f0f4e75cbcbb27dceca1f2733b858e592aa3d5 /test/SemaTemplate/instantiate-member-class.cpp
parentf0594d8b64cf32c55dde7a49ba849e864446c92b (diff)
We may fail to map a declaration in a template to its instantiated
declaration because of interesting ordering dependencies while instantiating a class template or member class thereof. Complain, rather than asserting (+Asserts) or silently rejecting the code (-Asserts). Fixes the crash-on-invalid in PR8965. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127129 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/instantiate-member-class.cpp')
-rw-r--r--test/SemaTemplate/instantiate-member-class.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/SemaTemplate/instantiate-member-class.cpp b/test/SemaTemplate/instantiate-member-class.cpp
index f1bdf3e1e6..74c2609dcd 100644
--- a/test/SemaTemplate/instantiate-member-class.cpp
+++ b/test/SemaTemplate/instantiate-member-class.cpp
@@ -1,5 +1,28 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+namespace PR8965 {
+ template<typename T>
+ struct X {
+ typedef int type;
+
+ T field; // expected-note{{in instantiation of member class}}
+ };
+
+ template<typename T>
+ struct Y {
+ struct Inner;
+
+ typedef typename X<Inner>::type // expected-note{{in instantiation of template class}}
+ type; // expected-note{{not-yet-instantiated member is declared here}}
+
+ struct Inner {
+ typedef type field; // expected-error{{no member 'type' in 'PR8965::Y<int>'; it has not yet been instantiated}}
+ };
+ };
+
+ Y<int> y; // expected-note{{in instantiation of template class}}
+}
+
template<typename T>
class X {
public: