**Describe the bug**
`sync` here is a pointer to a global `sync` function implicitly converted to a bool:

https://github.com/ClickHouse/ClickHouse/blob/624ccd5206a7be7c8a56f2f7590e13d57a074008/src/Databases/DatabaseReplicated.cpp#L797

**How to reproduce**
compile `master` or `v22.8.4.7-lts` with warnings enabled

**Error message and/or stacktrace**


if (!local_context->getZooKeeperMetadataTransaction() && !ddl_worker->isCurrentlyActive())
        return true;
    UInt64 local_digest = 0;
    {
        std::lock_guard lock{mutex};
        for (const auto & table : TSA_SUPPRESS_WARNING_FOR_READ(tables))
            local_digest += getMetadataHash(table.first);
    }
    if (local_digest != tables_metadata_digest)
    {
        LOG_ERROR(log, "Digest of local metadata ({}) is not equal to in-memory digest ({})", local_digest, tables_metadata_digest);
        return false;
    }
    
    if (local_context->isInternalSubquery())
        return true;
    
    if (is_recovering)
        return true;
    String zk_digest = getZooKeeper()->get(replica_path + "/digest");
    String local_digest_str = toString(local_digest);
    if (zk_digest != local_digest_str)
    {
        LOG_ERROR(log, "Digest of local metadata ({}) is not equal to digest in Keeper ({})", local_digest_str, zk_digest);
        return false;
    }
    return true;
}
void DatabaseReplicated::checkQueryValid(const ASTPtr & query, ContextPtr query_context) const