================
@@ -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());
----------------
erichkeane wrote:

> nit: This can be simplified using `std::optional`:
> 
> ```c++
> std::optional<ContextRAII> C;
> if (!A.getDeclContext()->isFileContext())
>   C.emplace(*this, A->getDeclContext());
> ```

Neat trick, I like it!

https://github.com/llvm/llvm-project/pull/83847
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to