summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
diff options
context:
space:
mode:
authorSerge Pavlov <sepavloff@gmail.com>2015-06-29 17:50:19 +0000
committerSerge Pavlov <sepavloff@gmail.com>2015-06-29 17:50:19 +0000
commit3739f5e7c9d33d0ceed7f849505a91efa01294c5 (patch)
tree8279b1818069e4aedc926690282f42c2cc6817b5 /clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
parentae51f5bab147fffbb82756d4216a7ae2606118eb (diff)
downloadbcm5719-llvm-3739f5e7c9d33d0ceed7f849505a91efa01294c5.tar.gz
bcm5719-llvm-3739f5e7c9d33d0ceed7f849505a91efa01294c5.zip
Instantiation of local class members.
If a function containing a local class is instantiated, instantiate all of local class member, including default arguments and exception specifications. This change fixes PR21332 and thus implements DR1484. Differential Revision: http://reviews.llvm.org/D9990 llvm-svn: 240974
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplateInstantiateDecl.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index f35d1aaf77e..e240c705082 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -3246,10 +3246,18 @@ TemplateDeclInstantiator::InitFunctionInstantiation(FunctionDecl *New,
// DR1330: In C++11, defer instantiation of a non-trivial
// 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) {
+ EPI.ExceptionSpec.Type != EST_BasicNoexcept &&
+ !RequireInstantiation) {
FunctionDecl *ExceptionSpecTemplate = Tmpl;
if (EPI.ExceptionSpec.Type == EST_Uninstantiated)
ExceptionSpecTemplate = EPI.ExceptionSpec.SourceTemplate;
OpenPOWER on IntegriCloud