diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-09-02 13:05:45 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-09-02 13:05:45 +0000 |
commit | 12bbfe1d313880ba55dfa36563aae99bcc2c568f (patch) | |
tree | b0a66254b94ccc26803b69293e90dc808f613476 /clang/lib/Sema/SemaTemplate.cpp | |
parent | 4469c164d0d56e185647ded2a05d5877307c5611 (diff) | |
download | bcm5719-llvm-12bbfe1d313880ba55dfa36563aae99bcc2c568f.tar.gz bcm5719-llvm-12bbfe1d313880ba55dfa36563aae99bcc2c568f.zip |
When parsing typename specifiers (with either the identifier or
simple-template-id form), check whether the scope specifier is
computable as a declaration context rather than checking whether it is
dependent, so that we properly cope with members of the current
instantiation.
Improve testing for typename specifiers that terminate in a
simpe-template-id.
llvm-svn: 80783
Diffstat (limited to 'clang/lib/Sema/SemaTemplate.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 3985c1c0e02..8566789ccdf 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -1137,9 +1137,7 @@ Sema::ActOnDependentTemplateName(SourceLocation TemplateKWLoc, NestedNameSpecifier *Qualifier = static_cast<NestedNameSpecifier *>(SS.getScopeRep()); - // FIXME: member of the current instantiation - - if (!Qualifier->isDependent()) { + if (computeDeclContext(SS, false)) { // C++0x [temp.names]p5: // If a name prefixed by the keyword template is not the name of // a template, the program is ill-formed. [Note: the keyword @@ -3010,10 +3008,16 @@ Sema::ActOnTypenameType(SourceLocation TypenameLoc, const CXXScopeSpec &SS, = T->getAsTemplateSpecializationType(); assert(TemplateId && "Expected a template specialization type"); - if (NNS->isDependent()) - return Context.getTypenameType(NNS, TemplateId).getAsOpaquePtr(); - - return Context.getQualifiedNameType(NNS, T).getAsOpaquePtr(); + if (computeDeclContext(SS, false)) { + // If we can compute a declaration context, then the "typename" + // keyword was superfluous. Just build a QualifiedNameType to keep + // track of the nested-name-specifier. + + // FIXME: Note that the QualifiedNameType had the "typename" keyword! + return Context.getQualifiedNameType(NNS, T).getAsOpaquePtr(); + } + + return Context.getTypenameType(NNS, TemplateId).getAsOpaquePtr(); } /// \brief Build the type that describes a C++ typename specifier, |