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

            Bug ID: 61471
           Summary: redeclaration of default-argument in function template
                    declaration not caught
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: filip.roseen at gmail dot com

Created attachment 32921
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32921&action=edit
testcase.cpp

template<class T> void f(int=3);
template<class T> void f(int=3); // ill-formed

int main () { }

------------------------

`gcc` inaccurately accepts the above snippet, which is violating the following
[dcl.fct.default]p4:

 > A default argument shall not be redefined b a later declaration
 > (not even to the same value).

------------------------

By making `f` a non-template the violating is caught, and appropriate
diagnostics are shown.

Reply via email to