When a function returns a type and that type was declared [[nodiscard]], we diagnose any unused results from that call as though the function were marked nodiscard. The same behavior should apply to calls through a function pointer.
This addresses PR31526.
This duplicates some logic from FunctionDecl::hasUnusedResultAttr(), maybe we should move that member function to the CallExpr?