Files
2025-10-25 03:02:53 +03:00

79 lines
2.5 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[diff.cpp23.expr]
# Annex C (informative) Compatibility [[diff]](./#diff)
## C.1 C++ and ISO C++ 2023 [[diff.cpp23]](diff.cpp23#expr)
### C.1.3 [[expr]](expr "7Expressions"): expressions [diff.cpp23.expr]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/compatibility.tex#L49)
**Affected subclause:** [[expr.arith.conv]](expr.arith.conv)
**Change:** Operations mixing a value of an enumeration type and a value of a different
enumeration type or of a floating-point type are no longer valid[.](#1.sentence-1)
**Rationale:** Reinforcing type safety[.](#1.sentence-2)
**Effect on original feature:** A valid C++ 2023 program that performs operations mixing a value of an
enumeration type and a value of a different enumeration type or of a
floating-point type is ill-formed[.](#1.sentence-3)
[*Example [1](#example-1)*: enum E1 { e };enum E2 { f };bool b = e <= 3.7; // ill-formed; previously well-formedint k = f - e; // ill-formed; previously well-formedauto x = true ? e : f; // ill-formed; previously well-formed — *end example*]
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/compatibility.tex#L69)
**Affected subclauses:** [[expr.rel]](expr.rel) and [[expr.eq]](expr.eq)
**Change:** Comparing two objects of array type is no longer valid[.](#2.sentence-1)
**Rationale:** The old behavior was confusing since it compared not the contents of the two
arrays, but their addresses[.](#2.sentence-2)
**Effect on original feature:** A valid C++ 2023 program directly comparing two array objects is rejected as
ill-formed in this document[.](#2.sentence-3)
[*Example [2](#example-2)*: int arr1[5];int arr2[5];bool same = arr1 == arr2; // ill-formed; previously well-formedbool idem = arr1 == +arr2; // compare addressesbool less = arr1 < +arr2; // compare addresses, unspecified result — *end example*]
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/compatibility.tex#L88)
**Affected subclause:** [[expr.delete]](expr.delete)
**Change:** Calling delete on a pointer to an incomplete class is ill-formed[.](#3.sentence-1)
**Rationale:** Reduce undefined behavior[.](#3.sentence-2)
**Effect on original feature:** A valid C++ 2023 program that calls delete on an incomplete
class type is ill-formed[.](#3.sentence-3)
[*Example [3](#example-3)*: struct S;
void f(S *p) {delete p; // ill-formed; previously well-formed}struct S {}; — *end example*]