LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 39606 - std::function does not have deduction guides
Summary: std::function does not have deduction guides
Status: RESOLVED FIXED
Alias: None
Product: libc++
Classification: Unclassified
Component: All Bugs (show other bugs)
Version: unspecified
Hardware: PC All
: P enhancement
Assignee: Louis Dionne
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-09 10:47 PST by Louis Dionne
Modified: 2021-03-02 13:44 PST (History)
3 users (show)

See Also:
Fixed By Commit(s): e1eabcdfad89f67ae575b0c86aa4a72d277378b4


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Louis Dionne 2018-11-09 10:47:44 PST
We're missing deduction guides for std::function. The following code does not compile with libc++ trunk:

--------------------------------------
#include <functional>

int func(double) { return 0; }
int main() {
  std::function f{func}; // guide #1 deduces function<int(double)>
  int i = 5;
  std::function g = [&](double) { return i; }; // guide #2 deduces function<int(double)>
}
--------------------------------------

Taken from SO question: https://stackoverflow.com/q/53217511/1708801
Comment 1 Louis Dionne 2021-03-02 13:44:04 PST
Fixed a while ago in:

commit e1eabcdfad89f67ae575b0c86aa4a72d277378b4
Author: Louis Dionne <ldionne@apple.com>
Date:   Thu Jul 18 19:50:56 2019 +0000

    [libc++] Add C++17 deduction guides for std::function

    Summary: http://llvm.org/PR39606

    Reviewers: Quuxplusone

    Subscribers: christof, dexonsmith, libcxx-commits

    Differential Revision: https://reviews.llvm.org/D54410

    llvm-svn: 366484