Forráskód Böngészése

Merge pull request #108199 from Ivorforce/3x-derives-from-if-constexpr

3.x: Use `if constexpr` in `Object::derives_from`
lawnjelly 1 hónapja
szülő
commit
17b5769d56
1 módosított fájl, 1 hozzáadás és 1 törlés
  1. 1 1
      core/object.h

+ 1 - 1
core/object.h

@@ -797,7 +797,7 @@ bool Object::derives_from() const {
 	static_assert(std::is_same<std::decay_t<T>, typename T::self_type>::value, "T must use GDCLASS or GDSOFTCLASS");
 	static_assert(std::is_same<std::decay_t<T>, typename T::self_type>::value, "T must use GDCLASS or GDSOFTCLASS");
 
 
 	// If there is an explicitly set ancestral class on the type, we can use that.
 	// If there is an explicitly set ancestral class on the type, we can use that.
-	if (T::static_ancestral_class != T::super_type::static_ancestral_class) {
+	if constexpr (T::static_ancestral_class != T::super_type::static_ancestral_class) {
 		return _has_ancestry(T::static_ancestral_class);
 		return _has_ancestry(T::static_ancestral_class);
 	} else {
 	} else {
 		return is_class_ptr(T::get_class_ptr_static());
 		return is_class_ptr(T::get_class_ptr_static());