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

--- Comment #2 from Ghyslain Leclerc <ghleclerc at gmail dot com> ---
I wanted to add that on top of not complaining about the default parameter
redefinition, when the default parameter is provided in the definition only
(not the declaration of the template), the compilation fails.

Here is the snippet of code I used to have the bug.  Since it does not contain
any includes and the preprocessed file is basically the same, I think it's OK
to just have the code here.


template< typename T, unsigned int TSz >
T mul( T num );

template< typename T, unsigned int TSz = sizeof( T ) >
T mul( T num ) {
  return num * TSz;
}

int main() {
  return mul( 5 );
}


Given this code, the compiler fails to compile and outputs an error.  I have
done as recommended on the bug reporting page and gotten all the output.  I
will attach the files to this bug report.  Hoping it's OK.  It seems like the
two bugs might be the same or at least related.

Reply via email to