Root to leaf path with given sum in binary tree
Give your operators some breathing space.

    if (!node) {
        return sum == 0;
    }

    return hasPathSum(node-&gt;left,  sum - node-&gt;data) || 
           hasPathSum(node-&gt;right, sum - node-&gt;data);


Note that return expression needs no parenthesis.
sum - node-&gt;data seems more natural to be expressed once:

    sum -= node-&gt;data;
    return hasPathSum(node-&gt;left,  sum) || 
           hasPathSum(node-&gt;right, sum);

I see no edge cases except possible overflows.