From 6e395ef1518c376e67d1a9c0bd29230ae65fc394 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amanda=20Hamblin-Tru=C3=A9?= Date: Mon, 19 Jun 2023 17:26:22 +0200 Subject: [PATCH] Revamp Bindable Properties Example The use of Q_ASSERT(false) is bogus as we don't need to test here, but want to signal unreachability. Q_UNREACHABLE_RETURN allows us to tell the compiler that the point can't be reached while also getting rid of the no return error. Task-number: QTBUG-114689 Change-Id: I007cd243055237bcc21772a4130a6c1a44fd882d Reviewed-by: Ulf Hermann (cherry picked from commit ce39beea0cd49bb93b0e345194265dd8081094cd) Reviewed-by: Qt Cherry-pick Bot --- .../bindablesubscription/bindablesubscription.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/corelib/bindableproperties/bindablesubscription/bindablesubscription.cpp b/examples/corelib/bindableproperties/bindablesubscription/bindablesubscription.cpp index a52b68f85bb..8b8321859b3 100644 --- a/examples/corelib/bindableproperties/bindablesubscription/bindablesubscription.cpp +++ b/examples/corelib/bindableproperties/bindablesubscription/bindablesubscription.cpp @@ -38,8 +38,7 @@ double BindableSubscription::calculateDiscount() const case Yearly: return 0.6; } - Q_ASSERT(false); - return -1; + Q_UNREACHABLE_RETURN(-1); } int BindableSubscription::basePrice() const