balazske added inline comments.

================
Comment at: clang/lib/AST/ASTImporter.cpp:5961-5962
 
   if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
     return std::move(Err);
 
----------------
martong wrote:
> Do you think that the alternative approach that is used with 
> `TypedefNameDecl` could work here?
> ```
>   // Do not import the DeclContext, we will import it once the TypedefNameDecl
>   // is created.
>   if (Error Err = ImportDeclParts(D, Name, ToD, Loc))
>     return std::move(Err);
> ```
> With that perhaps we could avoid the hassle with the `update`. Could you 
> please investigate that?
The problem is not with the DC of the `FunctionTemplateDecl`, it is with the 
template parameters. It looks not safe to pass nullptr as `DeclContext` for 
these, this is only possible if the import is done. (Probably the solution in 
`TypedefNameDecl` is not perfect: If something exists already in the "To TU" 
that was not imported, specially a namespace that contains a typedef with same 
name, it may not be found before the import.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103792/new/

https://reviews.llvm.org/D103792

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to