[LLVMbugs] [Bug 22085] New: fails to copy an std::pair
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat Jan 3 10:16:22 PST 2015
http://llvm.org/bugs/show_bug.cgi?id=22085
Bug ID: 22085
Summary: fails to copy an std::pair
Product: clang
Version: 3.5
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: marc.glisse at normalesup.org
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
http://stackoverflow.com/q/27748442/1918193
g++ and Intel accept the code just fine. Oracle rejects it with a message
similar to clang. This code is quite possibly invalid, but that would mean that
the meta-programming that is accumulating in the standard library is making it
harder and harder to use CRTP. In any case, the error message could do with
some improvement.
Here is a reduced version:
struct A { static constexpr bool value = true; };
template <bool> struct conditional {};
template <typename _B1, typename _B2>
struct B : conditional<_B1::value> {};
template <typename _Tp> _Tp declval();
template <typename _From > struct C {
template <typename _To1> static void __test_aux(_To1);
template <typename _From1,
typename = decltype(__test_aux(declval<_From1>()))>
static A __test(int);
typedef decltype(__test<_From>(0)) type;
};
template <typename _From> struct is_convertible : C<_From >::type {};
template <bool> struct I;
template <class, class> struct J {
template <class _U1, class _U2,
class = typename I<
B<is_convertible<_U1>, _U2>::value>::type>
J(J<_U1, _U2>);
};
template <class R_> struct F : R_::Kernel_base::Point_3 {};
template <typename K_base, typename Kernel_> struct G : K_base {
typedef K_base Kernel_base;
typedef F<Kernel_> Point_3;
};
template <class R_> class P { typename R_::Vector_3 base; };
template <class R_> class L { J<typename R_::Point_3, R_> base; };
template <class R_> class V { V(typename R_::Line_3); };
struct H;
struct D {
typedef P<H> Point_3;
typedef V<H> Vector_3;
typedef L<H> Line_3;
};
struct H : G<D, H> {};
void fn1() { J<F<H>, int> x(x); }
And here is a less reduced version to show that the same happens with libc++ /
libstdc++:
#include <utility>
template <class R_> struct F : R_::Kernel_base::Point_3 {};
template <typename K_base, typename Kernel_> struct G : K_base {
typedef K_base Kernel_base;
typedef F<Kernel_> Point_3;
};
template <class R_> class P { typename R_::Vector_3 base; };
template <class R_> class L {
typedef typename R_::Point_3 Point_3;
typedef R_ Vector_3;
typedef std::pair<Point_3, Vector_3> Base;
Base base;
};
template <class R_> class V { V(typename R_::Line_3); };
struct H;
struct D {
typedef P<H> Point_3;
typedef V<H> Vector_3;
typedef L<H> Line_3;
};
struct H : G<D, H> {};
typedef std::pair<F<H>, int> X;
void fn1() { X x(x); }
--
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/20150103/905fd41d/attachment.html>
More information about the llvm-bugs
mailing list