Skip to content
Snippets Groups Projects
Commit c628def5 authored by Marek Polacek's avatar Marek Polacek
Browse files

c++: P2865R5, Remove Deprecated Array Comparisons from C++26 [PR117788]


This patch implements P2865R5 by promoting the warning to permerror in
C++26 only.

In C++20 we should warn even without -Wall.  Jason fixed this in r15-5713
but let's add a test that doesn't use -Wall.

This caused a FAIL in conditionally_borrowed.cc because we end up
comparing two array types in equality_comparable_with ->
__weakly_eq_cmp_with.  That could be fixed in libstc++, perhaps by
adding std::decay in the appropriate place.

	PR c++/117788

gcc/c-family/ChangeLog:

	* c-warn.cc (do_warn_array_compare): Emit a permerror in C++26.

gcc/cp/ChangeLog:

	* typeck.cc (cp_build_binary_op) <case EQ_EXPR>: Don't check
	warn_array_compare.  Check tf_warning_or_error instead of just
	tf_warning.  Maybe return an error_mark_node in C++26.
	<case LE_EXPR>: Likewise.

gcc/testsuite/ChangeLog:

	* c-c++-common/Warray-compare-1.c: Expect an error in C++26.
	* c-c++-common/Warray-compare-3.c: Likewise.
	* c-c++-common/Warray-compare-4.c: New test.
	* c-c++-common/Warray-compare-5.c: New test.
	* g++.dg/warn/Warray-compare-1.C: New test.

libstdc++-v3/ChangeLog:

	* testsuite/std/ranges/adaptors/conditionally_borrowed.cc: Add a
	FIXME, adjust.

Reviewed-by: default avatarJason Merrill <jason@redhat.com>
parent 7a12dc69
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment