<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><span class="vcard"><a class="email" href="mailto:dblaikie@gmail.com" title="David Blaikie <dblaikie@gmail.com>"> <span class="fn">David Blaikie</span></a>
</span> changed
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - Compiler is using wrong template argument when a child class calls a templated constructor of a template class."
href="https://bugs.llvm.org/show_bug.cgi?id=48365">bug 48365</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>---
</td>
<td>INVALID
</td>
</tr>
<tr>
<td style="text-align:right;">CC</td>
<td>
</td>
<td>dblaikie@gmail.com
</td>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>NEW
</td>
<td>RESOLVED
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - Compiler is using wrong template argument when a child class calls a templated constructor of a template class."
href="https://bugs.llvm.org/show_bug.cgi?id=48365#c1">Comment # 1</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - Compiler is using wrong template argument when a child class calls a templated constructor of a template class."
href="https://bugs.llvm.org/show_bug.cgi?id=48365">bug 48365</a>
from <span class="vcard"><a class="email" href="mailto:dblaikie@gmail.com" title="David Blaikie <dblaikie@gmail.com>"> <span class="fn">David Blaikie</span></a>
</span></b>
<pre>Looks reasonable to me - the rest of the error message says:
"<source>:13:5: note: in instantiation of default argument for
'Base<Base<int>>' required here
Base(const U& v) {
^~~~~~~~~~~~~~~~~~
<source>:10:7: note: while substituting deduced template arguments into
function template 'Base' [with U = Base<int>, $1 = (no value)]
class Base {
^
<source>:17:7: note: while declaring the implicit copy constructor for 'Child'
class Child : public Base<int> {
^"
So it's not while trying to evaluate "Child child;"'s call to the "Child()"
ctor, which does correctly use the Base<int>::Base<float> ctor, but it's while
trying to declare Child's copy ctor - which, is the absence of any other ctor,
tries to use Base<int>::Base<Base<int>> to do the copy construction.
If you make the Base ctor not a valid ctor to use for copying (eg, by changing
its template parameter list to SFINAE out that option: "template <typename U,
typename = std::enable_if_t<!std::is_same_v<U, Base>>, typename = typename
CheckInt<U>::success>") then the build error goes away.
<a href="https://godbolt.org/z/6fGjhd">https://godbolt.org/z/6fGjhd</a>
Similarly, if the ctor in question had an extra parameter - there would be no
ambiguity: <a href="https://godbolt.org/z/oqGxhq">https://godbolt.org/z/oqGxhq</a></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>