This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] c++: Fix hashing and testing for equality of ATOMIC_CONST_EXPRs
On Fri, 14 Feb 2020, Jason Merrill wrote:
> On 2/12/20 5:15 PM, Patrick Palka wrote:
> > Two equal atomic constraint expressions do not necessarily share the same
> > tree,
> > so we can't assume that two ATOMIC_CONST_EXPRs are equal if and only if they
> > point to the same tree.
>
> This is incorrect; comparison of atomic constraints is based on them coming
> from the same actual tokens, which is why we use pointer comparison.
>
> In your concepts-partial-spec7.C, test2 is properly rejected. If you want to
> be able to write the same constraint in multiple places, you need to use a
> concept.
>
> 13.5.1.2:
>
> Two atomic constraints are identical if they are formed from the same
> expression and the targets of the parameter mappings are equivalent according
> to the rules for expressions described in 13.7.6.1.
I see, that makes complete sense now. I was stumbling over what the
spec meant by "the same expression." Thanks for clearing up my
misunderstanding.