fix: uninstantiated static_assert(false, "") was ill-formed
This is c++ language core issue, refactoring the implementation of dumpDBusObject. core issue: https://cplusplus.github.io/CWG/issues/2518.html gcc has fixed this bug since version 13.1: relative-commit: https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=9944ca17c0766623bce260684edc614def7ea761 Signed-off-by: ComixHe <heyuming@deepin.org>
This commit is contained in:
		@ -544,6 +544,8 @@ template <typename Key, typename Value>
 | 
			
		||||
ObjectMap dumpDBusObject(const QHash<Key, QSharedPointer<Value>> &map)
 | 
			
		||||
{
 | 
			
		||||
    static_assert(std::is_base_of_v<QObject, Value>, "dumpDBusObject only support which derived by QObject class");
 | 
			
		||||
    static_assert(std::is_same_v<Key, QString> || std::is_same_v<Key, QDBusObjectPath>,
 | 
			
		||||
                  "dumpDBusObject only support QString/QDBusObject as key type");
 | 
			
		||||
    ObjectMap objs;
 | 
			
		||||
 | 
			
		||||
    for (const auto &[key, value] : map.asKeyValueRange()) {
 | 
			
		||||
@ -552,8 +554,6 @@ ObjectMap dumpDBusObject(const QHash<Key, QSharedPointer<Value>> &map)
 | 
			
		||||
            objs.insert(QDBusObjectPath{getObjectPathFromAppId(key)}, interAndProps);
 | 
			
		||||
        } else if constexpr (std::is_same_v<Key, QDBusObjectPath>) {
 | 
			
		||||
            objs.insert(key, interAndProps);
 | 
			
		||||
        } else {
 | 
			
		||||
            static_assert(false, "dumpDBusObject only support QString/QDBusObject as key type");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user