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: unassignedclangb...@nondot.org
          Reporter: rs2...@gmail.com
                CC: llvm-bugs@lists.llvm.org, mclow.li...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to