[llvm-bugs] [Bug 31330] New: incorrectly accepts non-deductible template parameter pack in function template

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Dec 9 07:06:23 PST 2016


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

            Bug ID: 31330
           Summary: incorrectly accepts non-deductible template parameter
                    pack in function template
           Product: clang
           Version: 3.9
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: felix.morgner at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

clang++ incorrectly accepts the following code that contains a non-deductible
template parameter pack:

  #include <utility>

  template<std::size_t ...Ns, typename ...Ts>
  void foo(std::index_sequence<Ns...>)
    {
    }

  int main()
    {
    foo(std::make_index_sequence<5>{});
    }

ISO14882:2014 states the following in [temp.param]:

(9) [...] A default template-argument may be specified for any kind of
template-parameter (type, non-type, template) that is not a template parameter
pack (14.5.3). [...]

(11) [...]  A template parameter pack of a function template shall not be
followed by another template parameter unless that template parameter can be
deduced from the parameter-type-list of the function template or has a default
argument (14.8.2).

It also gives an example similar to the above. As far as I can tell, it is
neither possible to deduce nor to specify the types for 'Ts' and thus this
template function should be rejected.

The example code was compiled with the following command line invocation:

  clang++ -Wall -Wextra -pedantic -pedantic-errors -Werror -std=c++14 templ.cpp

-- 
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/20161209/b0b1fc87/attachment.html>


More information about the llvm-bugs mailing list