[Bug c++/34691] New: Default argument checking not performed after overload resolution.

rideau3 at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Jan 6 20:31:00 GMT 2008


The following code is ill-formed according to the standard, but accepted by
GCC:

namespace A {
        extern "C" void f(int = 5);
}
namespace B {
        extern "C" void f(int = 4);
}

using A::f;
using B::f;
int main() {
    f(3);    //OK
    f();     //ERROR
}

When a default argument is used as in the second call, it needs to be looked up
to make sure it isn't declared twice. If it is, then it's an error. GCC will
also accept the code whether the default arguments to f() are given the same or
different values.


-- 
           Summary: Default argument checking not performed after overload
                    resolution.
           Product: gcc
           Version: 4.1.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rideau3 at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34691



More information about the Gcc-bugs mailing list