[llvm-bugs] [Bug 40378] New: Failed template argument deduction for std::initializer_list with T=std::complex<double>

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jan 19 02:21:56 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=40378

            Bug ID: 40378
           Summary: Failed template argument deduction for
                    std::initializer_list with T=std::complex<double>
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++'17
          Assignee: unassignedclangbugs at nondot.org
          Reporter: stackptr at users.sourceforge.net
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Created attachment 21356
  --> https://bugs.llvm.org/attachment.cgi?id=21356&action=edit
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:
https://godbolt.org/z/6dhO6e


#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);
}

-- 
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/20190119/38b60644/attachment.html>


More information about the llvm-bugs mailing list