<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Failed template argument deduction for std::initializer_list with T=std::complex<double>"
href="https://bugs.llvm.org/show_bug.cgi?id=40378">40378</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Failed template argument deduction for std::initializer_list with T=std::complex<double>
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>8.0
</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++'17
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>stackptr@users.sourceforge.net
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=21356" name="attach_21356" title="list-init-tmpl-arg-fail.cc">attachment 21356</a> <a href="attachment.cgi?id=21356&action=edit" title="list-init-tmpl-arg-fail.cc">[details]</a></span>
list-init-tmpl-arg-fail.cc
clang++ fails to infer the template argument std::complex<double> for
direct/copy list initialization of an std::initializer_list object. Current
versions of both g++ and msvc successfully compile:
<a href="https://godbolt.org/z/6dhO6e">https://godbolt.org/z/6dhO6e</a>
#include <cstdio>
#include <initializer_list>
#include <complex>
using namespace std::literals;
#ifdef _MSC_VER
#define __pfunc__ __FUNCSIG__
#else
#define __pfunc__ __PRETTY_FUNCTION__
#endif
#define TRACE() fprintf(stdout, "%s:%u: %s\n", __FILE__, __LINE__, __pfunc__)
template<class T>
void fun(std::initializer_list<T> const &il) { TRACE(); }
int main() {
std::initializer_list il = {1.0+2.0i, 1.0+0.0i, 3.4+4.3i}; // error
fun(il);
}</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>