summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorIlya Biryukov <ibiryukov@google.com>2019-02-12 14:21:44 +0000
committerIlya Biryukov <ibiryukov@google.com>2019-02-12 14:21:44 +0000
commit6597fdd508f248f8bbb70b6fbf34b940677f2767 (patch)
treeaa262160c342289141eb927ee7436347945f9729 /clang/lib
parentce667f6df9715d5708d846cc9054a781765fcfa7 (diff)
downloadbcm5719-llvm-6597fdd508f248f8bbb70b6fbf34b940677f2767.tar.gz
bcm5719-llvm-6597fdd508f248f8bbb70b6fbf34b940677f2767.zip
[Sema] Fix a crash in access checking for deduction guides
Summary: See the added test for a repro. Reviewers: sammccall Reviewed By: sammccall Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58111 llvm-svn: 353840
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index c54e700f51c..8badbbd3ead 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -3175,7 +3175,11 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D,
// declared] with the same access [as the template].
if (auto *DG = dyn_cast<CXXDeductionGuideDecl>(NonTemplateMember)) {
auto *TD = DG->getDeducedTemplate();
- if (AS != TD->getAccess()) {
+ // Access specifiers are only meaningful if both the template and the
+ // deduction guide are from the same scope.
+ if (AS != TD->getAccess() &&
+ TD->getDeclContext()->getRedeclContext()->Equals(
+ DG->getDeclContext()->getRedeclContext())) {
Diag(DG->getBeginLoc(), diag::err_deduction_guide_wrong_access);
Diag(TD->getBeginLoc(), diag::note_deduction_guide_template_access)
<< TD->getAccess();
OpenPOWER on IntegriCloud