This is an automated email from the ASF dual-hosted git repository.

BiteTheDDDDt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new f4ce70ed503 [fix](be) Remove pure attribute from assert_cast (#63417)
f4ce70ed503 is described below

commit f4ce70ed50317cb85d0b081638f25ad4bcd699ca
Author: Pxl <[email protected]>
AuthorDate: Wed May 20 14:19:23 2026 +0800

    [fix](be) Remove pure attribute from assert_cast (#63417)
    
    Problem Summary: `assert_cast` can throw `doris::Exception` when release
    type checking detects an invalid cast. The function was annotated with
    `PURE`, but throwing an exception is an observable side effect and
    changes control flow, so the annotation gives the compiler an invalid
    optimization contract for the failure path. This removes the incorrect
    annotation and leaves the existing cast logic unchanged.
---
 be/src/core/assert_cast.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/be/src/core/assert_cast.h b/be/src/core/assert_cast.h
index acadf8705a7..d54f0ff31ba 100644
--- a/be/src/core/assert_cast.h
+++ b/be/src/core/assert_cast.h
@@ -50,7 +50,7 @@ using AssertCastClassType_t = 
std::remove_pointer_t<AssertCastNormalizedType_t<T
   * The exact match of the type is checked. That is, cast to the ancestor will 
be unsuccessful.
   */
 template <typename To, TypeCheckOnRelease check = TypeCheckOnRelease::ENABLE, 
typename From>
-PURE To assert_cast(From&& from) {
+To assert_cast(From&& from) {
     static_assert(!std::is_same_v<AssertCastNormalizedType_t<To>, 
AssertCastNormalizedType_t<From>>,
                   "assert_cast is redundant for the same type after removing 
cv/ref qualifiers");
     static_assert(std::is_class_v<AssertCastClassType_t<To>> &&


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to