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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2023-08-24 00:00:00         |

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note you don't need to use C++20 features to get the bad error message.
Testcase:
```
#include <initializer_list>
template<typename ...T>
static void S__f (T...) { }

struct S
{
  template<typename ...T>
  static void f (T ...) { }
};

int main ()
{
  S__f (1, { });
  S::f (1, { });
}
```

The error message changed between GCC 4.6 and GCC 4.7 though.
GCC 4.6 produced:
```
<source>: In function 'int main()':
<source>:13:15: error: no matching function for call to 'S__f(int,
<brace-enclosed initializer list>)'
<source>:13:15: note: candidate is:
<source>:3:13: note: template<class ... T> void S__f(T ...)
<source>:14:15: error: no matching function for call to 'S::f(int,
<brace-enclosed initializer list>)'
<source>:14:15: note: candidate is:
<source>:8:15: note: template<class ... T> static void S::f(T ...)
```
While GCC 4.7 produces the error message we know today:
```
<source>: In function 'int main()':
<source>:13:15: error: too many arguments to function 'void S__f(T ...) [with T
= {}]'
<source>:3:13: note: declared here
<source>:14:15: error: no matching function for call to 'S::f(int,
<brace-enclosed initializer list>)'
<source>:14:15: note: candidate is:
<source>:8:15: note: static void S::f(T ...) [with T = {}]
<source>:8:15: note:   candidate expects 0 arguments, 2 provided
```

Reply via email to