diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-09-26 03:49:48 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-09-26 03:49:48 +0000 |
commit | 10b55fc85ef3af114cca7c55b46b95da800a4bb3 (patch) | |
tree | ed06d60edbc898c56c22ac7d42730a85f882a70f /clang/lib/Sema/SemaTemplateInstantiate.cpp | |
parent | fde9485297895ac96ece2234021ec72270c703e7 (diff) | |
download | bcm5719-llvm-10b55fc85ef3af114cca7c55b46b95da800a4bb3.tar.gz bcm5719-llvm-10b55fc85ef3af114cca7c55b46b95da800a4bb3.zip |
If a partial specialization of a member template is declared within a class
template and defined outside it, don't instantiate it twice when instantiating
the surrounding class template specialization. That would cause us to reject
the code because we think two partial specializations instantiated to produce
the same signature.
llvm-svn: 191418
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiate.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiate.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index dd10cbe2b76..d85f7e4b1b8 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -2142,13 +2142,25 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, // Instantiate any out-of-line class template partial // specializations now. - for (TemplateDeclInstantiator::delayed_partial_spec_iterator + for (TemplateDeclInstantiator::delayed_partial_spec_iterator P = Instantiator.delayed_partial_spec_begin(), PEnd = Instantiator.delayed_partial_spec_end(); P != PEnd; ++P) { if (!Instantiator.InstantiateClassTemplatePartialSpecialization( - P->first, - P->second)) { + P->first, P->second)) { + Instantiation->setInvalidDecl(); + break; + } + } + + // Instantiate any out-of-line variable template partial + // specializations now. + for (TemplateDeclInstantiator::delayed_var_partial_spec_iterator + P = Instantiator.delayed_var_partial_spec_begin(), + PEnd = Instantiator.delayed_var_partial_spec_end(); + P != PEnd; ++P) { + if (!Instantiator.InstantiateVarTemplatePartialSpecialization( + P->first, P->second)) { Instantiation->setInvalidDecl(); break; } |