[PATCH] D153003: [ODRHash] Fix ODR hashing of template names

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 28 22:58:15 PDT 2023


ChuanqiXu added a comment.

In D153003#4456595 <https://reviews.llvm.org/D153003#4456595>, @rsmith wrote:

> I think the behavior change for the testcase here is correct, though I'm not sure that the patch is getting that behaviour change in the right way. Per [temp.type]/1.4 (http://eel.is/c++draft/temp.type#1.4),
>
>> Two template-ids are the same if [...] their corresponding template template-arguments refer to the same template.
>
> so `B<A>` and `B<NS::A>` are the same type. The stricter "same sequence of tokens" rule doesn't apply here, because using-declarations are not definitions.

Got it. Thanks for your commenting. I can't reopen this page. So I file an issue here https://github.com/llvm/llvm-project/issues/63595. @Hahnfeld you can still work on this by following the @rsmith 's suggestion  if you're still interested. Or I'd like to take it.

> But that also suggests that ODR hashing should not be visiting these template arguments in using-declarations at all, because the ODR does not apply to the types specified in a namespace-scope using-declaration. How to we even get into the ODR hasher here? I thought we only applied it to function and class definitions (to which the ODR does apply).

I think this comes from we add ODRHash for  RecordDecl. This is landed in https://reviews.llvm.org/D71734. Do you have suggestion on this? e.g., only limit this for C and Objective-C? So that we can solve the issue naturally.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153003



More information about the cfe-commits mailing list