This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]