From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jens.Maurer@gmx.net To: gcc-gnats@gcc.gnu.org Subject: c++/4205: function template can call other function with incorrect parameters Date: Sun, 02 Sep 2001 10:16:00 -0000 Message-id: <20010902171430.4416.qmail@sourceware.cygnus.com> X-SW-Source: 2001-09/msg00029.html List-Id: >Number: 4205 >Category: c++ >Synopsis: function template can call other function with incorrect parameters >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: accepts-illegal >Submitter-Id: net >Arrival-Date: Sun Sep 02 10:16:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Jens Maurer >Release: gcc 3.0.1 >Organization: >Environment: Linux 2.4.8 with glibc 2.2.3 >Description: The attached code should give an error at least in the call to foo(&wibble), because you can't call wibble() with just one argument, but these gcc versions don't: gcc version 3.0.1 gcc version 3.1 20010901 (experimental) gcc version 2.95.3 20010315 (release) >How-To-Repeat: // Douglas Gregor on boost 2001-08-22 #include template void foo(F f) { f(1); } void bar(int i, int j = 5, int k = 7) { std::cout << "bar(" << i << ", " << j << ", " << k << ")" << std::endl; } void wibble(int i, int j, int k = 9) { std::cout << "wibble(" << i << ", " << j << ", " << k << ")" << std::endl; } int main() { foo(&bar); foo(&wibble); // should give an error, "wibble" cannot be called with one arg } >Fix: >Release-Note: >Audit-Trail: >Unformatted: