[clang] [Clang] Correctly construct template arguments for template template parameters (PR #76811)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 5 08:48:25 PST 2024


erichkeane wrote:

> Thank you for the feedback.
> 
> > I wouldn't be surprised if it is now being used in situations where the decl-context hasn't been appropriately updated
> 
> I think this is not the case where we’re dealing with ill-formed Decl-contexts; it is that the caller site doesn't respect the assumption that “the surrounding Decl for a TTPD shall be a file-scope decl”.
> 
> > I'd suggest looking to see if you can figure out where the correct arguments are.
> 
> I think I’ve already done that? (I have updated the patch to address it and that looks fine then), I’m just unsure if the removal for such assumption is appropriate. (or maybe i’m misreading your points? Should I change the call sites instead?)

That TTPD eventually DOES get the correct decl context, right?  Or have you found a case where the decl context is NEVER set right?  In some cases, we start forming a declaration without properly setting its decl context, then come along afterwards and 'fix' it up, so if this is THAT case, we can either change the caller to set it 'earlier' (if possible?), or make this function tolerant of it.

If it is NEVER set, then yes, we SHOULD be making sure the declaration context is set correctly.  That said, even in a template-template parameter, we shouldn't really NEED the decl context, since it should be the decl context of hte declaration it is associated with.

https://github.com/llvm/llvm-project/pull/76811


More information about the cfe-commits mailing list