<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - fails to copy an std::pair"
href="http://llvm.org/bugs/show_bug.cgi?id=22085">22085</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>fails to copy an std::pair
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.5
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>marc.glisse@normalesup.org
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre><a href="http://stackoverflow.com/q/27748442/1918193">http://stackoverflow.com/q/27748442/1918193</a>
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); }</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>