https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84857

            Bug ID: 84857
           Summary: A valid call to a template function in a variadic
                    template struct is rejected
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: v.reshetnikov at gmail dot com
  Target Milestone: ---

The following C++ code is rejected by GCC 8.0.1 20180313 (tested with
https://godbolt.org/):

/************* SOURCE *************/
template<typename... T>
struct S {
    template<T... xs>
    static int f() {
        return 0;
    }
};

int t = S<int, int>::f<0, 0>();
/*********** END SOURCE ***********/


/************* OUTPUT *************/
<source>:9:30: error: no matching function for call to 'S<int, int>::f<0, 0>()'
 int t = S<int, int>::f<0, 0>();
                              ^
<source>:4:16: note: candidate: 'template<T ...xs> static int S<T>::f() [with T
...xs = {xs ...}; T = {int, int}]'
     static int f() {
                ^
<source>:4:16: note:   template argument deduction/substitution failed:
<source>:9:30: error: wrong number of template arguments (2, should be 1)
 int t = S<int, int>::f<0, 0>();
                              ^
Compiler returned: 1
/*********** END OUTPUT ***********/

I believe this code is correct and should be accepted.

Reply via email to