Why we use the friend function in C ++

C ++ compiler error when mixing Variadic templates and Friend function

Problem Description

When declaring a Variadic function template as a friend of the class template, the C ++ compiler returns an error message instead of the code. For example, if you execute the following declaration:

You receive the following error message:

Error C2783: 'Void f (C , B)': Template argument for 'U' could not be derived

root cause

The cause is that the C ++ compiler can match the declaration of the friend function with an existing declaration.

Troubleshooting

This update is available from the Microsoft Download Center.

Microsoft Download Center

For more information about how to download Microsoft support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to obtain Microsoft support files from online services

Microsoft scanned this file for viruses. Microsoft was using the most recent virus-detection software available at the time the file was published. The file is stored on servers with increased security, which prevents unauthorized changes to the file.

requirements

This hotfix requires Visual Studio 2015 Update 3.

Reboot information

You must restart the computer after you apply this hotfix.

Replaced

This hotfix does not replace any previously released hotfix.

File information

The English version of this hotfix has the file attributes (or later attributes) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the tab Time zone under Date and Time in the control panel.

Filename

File version

File size

date

time

platform

VC14-KB4096429.exe

14.0.24240

19,177,304

04/19/2018

32 PM

X86

WORKAROUND

To work around this problem, do not declare the Variadic function template as a friend of the class template.