'Function must return a value error even when it does

This is my code for counting inversions using merge sort but I'm getting the error "merge_sort : function must return a value" but as you can see the function does return a value. How do I fix this?

int merge_sort(std::vector<int>& src, int begin, int end)
{
    if (begin >= end) return;

    int mid = (begin + end) / 2;

    int leftinv = merge_sort(src, begin, mid);
    int rightinv = merge_sort(src, mid + 1, end);
    int splitinv = merge(src, begin, mid, end);

    return leftinv + rightinv + splitinv;
}


Solution 1:[1]

Could it be the conditional return: "if (begin >= end) return;"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 bindlegrunt