diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-05-14 00:28:11 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-05-14 00:28:11 +0000 |
commit | 3f5b61c394f4f205bcb4d316eb2a7a0a68b8af86 (patch) | |
tree | 4da57b179612b81db0cd320a032aa390044f29db /include/clang/Parse/Action.h | |
parent | 88f1ba0f0439e31ab57ffc088aa91137cadee585 (diff) |
Implement explicit instantiations of member classes of class templates, e.g.,
template<typename T>
struct X {
struct Inner;
};
template struct X<int>::Inner;
This change is larger than it looks because it also fixes some
a problem with nested-name-specifiers and tags. We weren't requiring
the DeclContext associated with the scope specifier of a tag to be
complete. Therefore, when looking for something like "struct
X<int>::Inner", we weren't instantiating X<int>.
This, naturally, uncovered a problem with member pointers, where we
were requiring the left-hand side of a member pointer access
expression (e.g., x->*) to be a complete type. However, this is wrong:
the semantics of this expression does not require a complete type (EDG
agrees).
Stuart vouched for me. Blame him.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71756 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Parse/Action.h')
-rw-r--r-- | include/clang/Parse/Action.h | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/include/clang/Parse/Action.h b/include/clang/Parse/Action.h index 10cdd73e1c..b65560bb24 100644 --- a/include/clang/Parse/Action.h +++ b/include/clang/Parse/Action.h @@ -1373,7 +1373,56 @@ public: return DeclResult(); } - + /// \brief Process the explicit instantiation of a member class of a + /// class template specialization. + /// + /// This routine is invoked when an explicit instantiation of a + /// member class of a class template specialization is + /// encountered. In the following example, + /// ActOnExplicitInstantiation will be invoked to force the + /// instantiation of X<int>::Inner: + /// + /// \code + /// template<typename T> class X { class Inner { /* ... */}; }; + /// template class X<int>::Inner; // explicit instantiation + /// \endcode + /// + /// \param S the current scope + /// + /// \param TemplateLoc the location of the 'template' keyword that + /// specifies that this is an explicit instantiation. + /// + /// \param TagSpec whether this declares a class, struct, or union + /// (template). + /// + /// \param KWLoc the location of the 'class', 'struct', or 'union' + /// keyword. + /// + /// \param SS the scope specifier preceding the template-id. + /// + /// \param Template the declaration of the class template that we + /// are instantiation. + /// + /// \param LAngleLoc the location of the '<' token in the template-id. + /// + /// \param TemplateArgs the template arguments used to form the + /// template-id. + /// + /// \param TemplateArgLocs the locations of the template arguments. + /// + /// \param RAngleLoc the location of the '>' token in the template-id. + /// + /// \param Attr attributes that apply to this instantiation. + virtual DeclResult + ActOnExplicitInstantiation(Scope *S, SourceLocation TemplateLoc, + unsigned TagSpec, + SourceLocation KWLoc, + const CXXScopeSpec &SS, + IdentifierInfo *Name, + SourceLocation NameLoc, + AttributeList *Attr) { + return DeclResult(); + } /// \brief Called when the parser has parsed a C++ typename /// specifier that ends in an identifier, e.g., "typename T::type". |