https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80026
Bug ID: 80026
Summary: Regression: passing unresolved function pointer to
variadic function template yields "too many arguments"
error
Product: gcc
Version: 7.0.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: [email protected]
Target Milestone: ---
Consider the following code:
void g(int) {}
void g(bool){}
template <class...S>
void f(S...){}
int main(){
f(&g);
}
As of 4.4.7 this gives "error: no matching function for call to 'f(<unresolved
overloaded function type>)'" which does not directly state the error but is
somewhat informative.
Since at least 4.6.4 until 7.0.1 I get "error: too many arguments to function
'void f(S ...) [with S = {}]'" which makes no sense for a variadic function
template.
live: https://godbolt.org/g/hvJh5F
Version info (-v output):
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../gcc-4.6.4/configure --prefix /root/staging
--build=x86_64-linux-gnu --disable-multilibs --disable-bootstrap
--enable-clocale=gnu --enable-languages=c,c++ --enable-ld=yes --enable-gold=yes
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-linker-build-id
--enable-lto --enable-plugins --enable-threads=posix --host=x86_64-linux-gnu
--target=x86_64-linux-gnu --with-pkgversion=GCC-Explorer-Build MAKEINFO=missing
Thread model: posix
gcc version 4.6.4 (GCC-Explorer-Build)
COLLECT_GCC_OPTIONS='-g' '-o'
'/tmp/compiler-explorer-compiler117213-16078-toh8kw.p3gjt9be29/output.s'
'-masm=intel' '-S' '-std=c++0x' '-v' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'
GNU C++ (GCC-Explorer-Build) version 4.6.4 (x86_64-linux-gnu)
compiled by GNU C version 5.4.0 20160609, GMP version 4.3.2, MPFR version
2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072