[LLVMbugs] [Bug 14036] declval/decltype -- incorrect deduction of return type for std::bind

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Oct 6 11:31:54 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=14036

David Blaikie <dblaikie at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |dblaikie at gmail.com,
                   |                            |hhinnant at apple.com
          Component|Frontend                    |All Bugs
            Version|trunk                       |unspecified
         Resolution|                            |INVALID
         AssignedTo|unassignedclangbugs at nondot. |hhinnant at apple.com
                   |org                         |
            Product|clang                       |libc++

--- Comment #2 from David Blaikie <dblaikie at gmail.com> 2012-10-06 13:31:54 CDT ---
Pretty sure this is by design:

__bind<std::__1::uniform_int_distribution<int> &,
std::__1::linear_congruential_engine<unsigned int, 48271, 0, 2147483647>
      &>
to 'func' (aka 
__bind<std::__1::uniform_int_distribution<int>,     
std::__1::linear_congruential_engine<unsigned int, 48271, 0,
      2147483647>>

Notice that the first template type argument to bind is a reference in the
first case (since you called bind with an lvalue, 'dist') and an rvalue in the
second (since you used declval<distribution<int>>()). To fix this I believe you
could use declval<std::uniform_int_distribution<int>&>().

[+Howard just in case he has a differing opinion]

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list