[llvm-bugs] [Bug 32606] New: std::decay mishandles abominable function types

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 10 12:49:22 PDT 2017


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

            Bug ID: 32606
           Summary: std::decay mishandles abominable function types
           Product: libc++
           Version: 4.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rs2740 at gmail.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

The current implementation causes a hard error when given an abominable
function type like 'int () const' because the non-taken branch of the
std::conditional ('typename remove_extent<_Up>::type*') attempts to form a
pointer to it:

template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS decay
{
private:
    typedef typename remove_reference<_Tp>::type _Up;
public:
    typedef typename conditional
                     <
                         is_array<_Up>::value,
                         typename remove_extent<_Up>::type*,
                         typename conditional
                         <
                              is_function<_Up>::value,
                              typename add_pointer<_Up>::type,
                              typename remove_cv<_Up>::type
                         >::type
                     >::type type;
};

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170410/fe3e1b0a/attachment.html>


More information about the llvm-bugs mailing list