Fix a rejects-valid with consteval on overloaded operators
authorAaron Ballman <aaron@aaronballman.com>
Thu, 14 Oct 2021 18:44:37 +0000 (14:44 -0400)
committerAaron Ballman <aaron@aaronballman.com>
Thu, 14 Oct 2021 18:47:29 +0000 (14:47 -0400)
commitb9941de0bfac4bad93e11dff26396e34a53e3891
treedb1f9a1f36124ac39184fb07a5adf4e09b7e4c7f
parente632e900ac1092f581b42fb93662613db9977b5a
Fix a rejects-valid with consteval on overloaded operators

It seems that Clang 11 regressed functionality that was working in
Clang 10 regarding calling a few overloaded operators in an immediate
context. Specifically, we were not checking for immediate invocations
of array subscripting and the arrow operators, but we properly handle
the other overloaded operators.

This fixes the two problematic operators and adds some test coverage to
show they're equivalent to calling the operator directly.

This addresses PR50779.
clang/lib/Sema/SemaOverload.cpp
clang/test/SemaCXX/cxx2a-consteval.cpp