[llvm-bugs] [Bug 43944] variadic template function passed an initializer list fails with argument count mismatch error rather than expected "couldn't deduce template parameter" error

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 6 18:12:33 PST 2020


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

Richard Smith <richard-llvm at metafoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #2 from Richard Smith <richard-llvm at metafoo.co.uk> ---
Fixed in llvmorg-10-init-16681-g907cefe7214. (This is slightly speculative;
I've mailed the C++ committee core working group to discuss this, but I think
deducing T as a pack of one unknown element here rather than as an empty pack
is obviously the right thing to do.)


We now accept the testcase from comment#0, and diagnose the testcase from
comment#1 as:

test.cc:28:5: error: no matching function for call to 'variadic'
    variadic({0});
    ^~~~~~~~
test.cc:12:27: note: candidate template ignored: substitution failure: deduced
incomplete pack <(no value)> for template parameter 'T'
template<class... T> void variadic(T&&...) {}
                  ~       ^
test.cc:32:5: error: no matching function for call to 'single'
    single({0});
    ^~~~~~
test.cc:14:24: note: candidate template ignored: couldn't infer template
argument 'T'
template<class T> void single(T&&) {}
                       ^

Note that we accept the

  x = {0};

line now, as a call to the move assignment operator (that is, as "x = X{0};"),
because deduction for the templated operator= now fails due to failing to
deduce a complete value for parameter T.

-- 
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/20200107/d1e07431/attachment.html>


More information about the llvm-bugs mailing list