[clang] Fix consteval operators in template contexts
authorMariya Podchishchaeva <mariya.podchishchaeva@intel.com>
Wed, 7 Jun 2023 14:28:04 +0000 (10:28 -0400)
committerMariya Podchishchaeva <mariya.podchishchaeva@intel.com>
Thu, 8 Jun 2023 08:26:45 +0000 (04:26 -0400)
commita1e5430b6adfe0fe19d831ab719fbec05b2cf5b7
treebdb9ebf175e39cc640daaa22b8d6bdfdd17be09b
parente35ff2605f695b9cf41d4f51260ccb866d4d34e0
[clang] Fix consteval operators in template contexts

Clang used to reject consteval operators if they're used inside a
template due to TreeTransform putting two different `DeclRefExpr`
expressions for the same reference of the same operator declaration into
`ReferenceToConsteval` set.
It seems there was an attempt to not rebuild the whole operator that
never succeeded, so this patch just removes this attempt and
problemating referencing of a `DeclRefExpr` that always ended up
discarded.

Fixes https://github.com/llvm/llvm-project/issues/62886

Reviewed By: cor3ntin

Differential Revision: https://reviews.llvm.org/D151553
clang/docs/ReleaseNotes.rst
clang/lib/Sema/TreeTransform.h
clang/test/SemaCXX/consteval-operators.cpp [new file with mode: 0644]
clang/test/SemaCXX/overloaded-operator.cpp