[clang] [Clang][Sema] Allow access to a public template alias declaration that refers to friend's private nested type (PR #83847)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 11 09:22:58 PDT 2024
================
@@ -4342,10 +4342,17 @@ QualType Sema::CheckTemplateIdType(TemplateName Name,
InstantiatingTemplate Inst(*this, TemplateLoc, Template);
if (Inst.isInvalid())
return QualType();
+ if (!AliasTemplate->getDeclContext()->isFileContext()) {
+ ContextRAII SavedContext(*this, AliasTemplate->getDeclContext());
----------------
zyn0217 wrote:
nit: This can be simplified using `std::optional`:
```cpp
std::optional<ContextRAII> C;
if (!A.getDeclContext()->isFileContext())
C.emplace(*this, A->getDeclContext());
```
https://github.com/llvm/llvm-project/pull/83847
More information about the cfe-commits
mailing list