Symptoms
When you try to declare a variadic function template as a friend of a class template, the C++ compiler would return an error message instead of accepting the code. For example, when you do the following declaration:
template<typename T>
struct B { };
template<typename... Types>
struct C { };
template<typename... Types, typename U>
void f(C<Types...>, B<U>)
{
}
template<typename T>
class A {
template<typename... Types, typename U>
friend void f(C<Types...>, B<U>);
};
int main()
{
f(C<int>{}, B<int>{});
A<int> a{};
};
You may receive the following error message:
error C2783: 'void f(C<Types...>,B<U>)': could not deduce template argument for 'U'
Cause
The cause is that the C++ compiler can't match the declaration of the friend function to an existing declaration.
Resolution
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:
119591How to obtain Microsoft support files from online services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help prevent any unauthorized changes to the file.
Prerequisites
This hotfix requires Visual Studio 2015 Update 3.
Restart information
You may have to restart the computer after you apply this hotfix.
Replacement information
This hotfix does not replace any previously released hotfix.
File information
The English version of this hotfix has the file attributes (or later file 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 Time Zone tab in the Date and Time item in Control Panel.
File name |
File version |
File size |
Date |
Time |
Platform |
VC14-KB4096429.exe |
14.0.24240 |
19,177,304 |
04/19/2018 |
02:32 AM |
X86 |
Workaround
To work around this issue, don't declare the variadic function template as a friend of a class template.