Re: [PATCH v1] c++: Hash placeholder constraint in ctp_hasher

2024-07-17 Thread Seyed Sajad Kahani
On Tue, 16 Jul 2024 at 17:05, Jason Merrill wrote: > The change looks good, just a couple of whitespace tweaks needed. But > what happened to the testcase? I was unable to design any testcase that differs by applying this patch, due to the proper handling of hash collisions (hash-table.h:1059).

Re: [PATCH v1] c++: Hash placeholder constraint in ctp_hasher

2024-07-16 Thread Jason Merrill
On 7/12/24 4:42 PM, Seyed Sajad Kahani wrote: This patch addresses a difference between the hash function and the equality function for canonical types of template parameters (ctp_hasher). The equality function uses comptypes (typeck.cc) (with COMPARE_STRUCTURAL) and checks constraint equality fo

Re: [PATCH v1] c++: Hash placeholder constraint in ctp_hasher

2024-07-12 Thread Seyed Sajad Kahani
I am sorry for the inconvenience, a fixed version was sent just now.

[PATCH v1] c++: Hash placeholder constraint in ctp_hasher

2024-07-12 Thread Seyed Sajad Kahani
This patch addresses a difference between the hash function and the equality function for canonical types of template parameters (ctp_hasher). The equality function uses comptypes (typeck.cc) (with COMPARE_STRUCTURAL) and checks constraint equality for two auto nodes (typeck.cc:1586), while the has

Re: [PATCH v1] c++: Hash placeholder constraint in ctp_hasher

2024-07-12 Thread Andrew Pinski
e can have > > two > > types with equal hashes that are unequal. For example, assuming: > > > > template > > concept C1 = ... > > > > template > > concept C2 = ... > > > > > > "C1 auto" and "C2 auto" have the same hash value but are unequal. This > > issue does not cause any error (it is a hash collision and it is handled), > > but > > it can be avoided by using hash_placeholder_constraint (constraint.cc:1150). > > > > Therefore, I have made the following changes: > > - Fixed the hash function to calculate the hash of the constraint > > (pt.cc:4528). > > - Slightly modified the existing hash_placeholder_constraint > > (constraint.cc:1150) to accept the initial hash value as an argument. > > > > Details of these changes can be found in the patch "[PATCH v1] c++: Hash > > placeholder constraint in ctp_hasher" that will be replied to this email. > > > > Thanks. I really appreciate your comments and feedback on these proposed > > changes.

Re: [PATCH v1] c++: Hash placeholder constraint in ctp_hasher

2024-07-12 Thread Patrick Palka
s placeholder constraints (typeck.cc:1586), > > while the hash function ignores them (pt.cc:4528). As a result, we can have > > two > > types with equal hashes that are unequal. For example, assuming: > > > > template > > concept C1 = ... > > > > template > > concept C2 = ... > > > > > > "C1 auto" and "C2 auto" have the same hash value but are unequal. This > > issue does not cause any error (it is a hash collision and it is handled), > > but > > it can be avoided by using hash_placeholder_constraint (constraint.cc:1150). > > > > Therefore, I have made the following changes: > > - Fixed the hash function to calculate the hash of the constraint > > (pt.cc:4528). > > - Slightly modified the existing hash_placeholder_constraint > > (constraint.cc:1150) to accept the initial hash value as an argument. > > > > Details of these changes can be found in the patch "[PATCH v1] c++: Hash > > placeholder constraint in ctp_hasher" that will be replied to this email. > > > > Thanks. I really appreciate your comments and feedback on these proposed > > changes. > >

[PATCH v1] c++: Hash placeholder constraint in ctp_hasher

2024-07-09 Thread Seyed Sajad Kahani
c:1150). > > Therefore, I have made the following changes: > - Fixed the hash function to calculate the hash of the constraint > (pt.cc:4528). > - Slightly modified the existing hash_placeholder_constraint > (constraint.cc:1150) to accept the initial hash value as an argument. > > Details of these changes can be found in the patch "[PATCH v1] c++: Hash > placeholder constraint in ctp_hasher" that will be replied to this email. > > Thanks. I really appreciate your comments and feedback on these proposed > changes.