diff options
author | Serge Pavlov <sepavloff@gmail.com> | 2015-08-23 10:22:28 +0000 |
---|---|---|
committer | Serge Pavlov <sepavloff@gmail.com> | 2015-08-23 10:22:28 +0000 |
commit | 73c6a2448f24d13e16f34d46095ef7ad4bd1f145 (patch) | |
tree | fc6716a8bd34d19bb692312d00e1288344ff8f4b /clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | |
parent | 1ac884d73afdc0c52c82e753cc45ae4887e753f7 (diff) | |
download | bcm5719-llvm-73c6a2448f24d13e16f34d46095ef7ad4bd1f145.tar.gz bcm5719-llvm-73c6a2448f24d13e16f34d46095ef7ad4bd1f145.zip |
Instantiate function declarations in instantiated functions.
If a function declaration is found inside a template function as in:
template<class T> void f() {
void g(int x = T::v) except(T::w);
}
it must be instantiated along with the enclosing template function,
including default arguments and exception specification.
Together with the patch committed in r240974 this implements DR1484.
Differential Revision: http://reviews.llvm.org/D11194
llvm-svn: 245810
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index c8a067658bf..9899f1e8b1a 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -3247,16 +3247,11 @@ TemplateDeclInstantiator::InitFunctionInstantiation(FunctionDecl *New, // exception specification. // DR1484: Local classes and their members are instantiated along with the // containing function. - bool RequireInstantiation = false; - if (CXXRecordDecl *Cls = dyn_cast<CXXRecordDecl>(Tmpl->getDeclContext())) { - if (Cls->isLocalClass()) - RequireInstantiation = true; - } if (SemaRef.getLangOpts().CPlusPlus11 && EPI.ExceptionSpec.Type != EST_None && EPI.ExceptionSpec.Type != EST_DynamicNone && EPI.ExceptionSpec.Type != EST_BasicNoexcept && - !RequireInstantiation) { + !Tmpl->isLexicallyWithinFunctionOrMethod()) { FunctionDecl *ExceptionSpecTemplate = Tmpl; if (EPI.ExceptionSpec.Type == EST_Uninstantiated) ExceptionSpecTemplate = EPI.ExceptionSpec.SourceTemplate; |