[llvm-bugs] [Bug 31481] New: 3+ parameter common_type isn't sufficiently SFINAE-friendly

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 27 10:57:29 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=31481

            Bug ID: 31481
           Summary: 3+ parameter common_type isn't sufficiently
                    SFINAE-friendly
           Product: libc++
           Version: unspecified
          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
    Classification: Unclassified

#include <type_traits>

struct A {};
template class std::common_type<int, int, A>;

In file included from prog.cc:1:
/usr/local/llvm-head/include/c++/v1/type_traits:2029:8: error: no type named
'type' in 'std::__1::common_type<int, A>'
    >::type type;
    ~~~^~~~
/usr/local/llvm-head/include/c++/v1/type_traits:2034:7: note: in instantiation
of template class 'std::__1::__common_type_impl<std::__1::__common_types<int,
int, A>, void>' requested here
    : __common_type_impl<__common_types<_Tp, _Up, _Vp...> > {};
      ^
prog.cc:4:22: note: in instantiation of template class
'std::__1::common_type<int, int, A>' requested here
template struct std::common_type<int, int, A>;
                     ^

The __void_t check for this case only verified the existence of
common_type<_Tp, _Up>::type, not common_type<typename common_type<_Tp,
_Up>::type, _Vp...>::type. The simplest fix is to inherit from
common_type<typename common_type<_Tp, _Up>::type, _Vp...> instead.

Of course, P0435R1 is touching this area again, but the principal change is to
the two-parameter version and not >2, so figured I'd file this anyway.

-- 
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/20161227/196fe07c/attachment-0001.html>


More information about the llvm-bugs mailing list