This is an archive of the discontinued LLVM Phabricator instance.

Do not inherit default arguments for friend function in class template.
ClosedPublic

Authored by sepavloff on Feb 26 2017, 10:05 PM.

Details

Summary

A function declared in a friend declaration may have declarations prior
to the containing class definition. If such declaration defines default
argument, the friend function declaration inherits them. This behavior
causes problems if the class where the friend is declared is a template:
during the class instantiation the friend function looks like if it had
default arguments, so error is triggered.

With this change friend functions declared in class templates do not
inherit default arguments. Actual set of them will be defined at the
point where the containing class is instantiated.

This change fixes PR12724.

Event Timeline

sepavloff created this revision.Feb 26 2017, 10:05 PM
sepavloff updated this revision to Diff 101512.Jun 5 2017, 10:58 PM

Rebased patch

rsmith accepted this revision.Jun 6 2017, 1:22 PM
This revision is now accepted and ready to land.Jun 6 2017, 1:22 PM
This revision was automatically updated to reflect the committed changes.