c++: Fix invalid pointer-to-member in requires [PR67825]
authorJason Merrill <jason@redhat.com>
Sat, 4 Apr 2020 15:04:55 +0000 (11:04 -0400)
committerJason Merrill <jason@redhat.com>
Sat, 4 Apr 2020 15:06:31 +0000 (11:06 -0400)
commitf1ad7bac76b662577e3bde78c530954099361a66
tree004cc66d52a4f6c00c0f39cfce25b563cb6a8421
parent9f143008c73c60e02634d6b433139a035ef7bb65
c++: Fix invalid pointer-to-member in requires [PR67825]

A recent change to cmcstl2 led to two tests failing due to this bug: our
valid expression checking in the context of a requires-expression wasn't
catching that an expression of member function type can only appear as the
function operand of a call expression.  Fixed by using convert_to_void to do
the same checking as a discarded-value expression.

This patch also fixes 67825, which already had a testcase, but the testcase
was testing for the wrong behavior.

gcc/cp/ChangeLog
2020-04-04  Jason Merrill  <jason@redhat.com>

PR c++/67825
* constraint.cc (tsubst_valid_expression_requirement): Call
convert_to_void.
gcc/cp/ChangeLog
gcc/cp/constraint.cc
gcc/testsuite/g++.dg/cpp2a/concepts-pmf1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/concepts-pr67825.C