Skip to content

Latest commit

 

History

History
36 lines (27 loc) · 1.08 KB

compiler-warning-level-2-c4396.md

File metadata and controls

36 lines (27 loc) · 1.08 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Compiler Warning (level 2) C4396
Compiler Warning (level 2) C4396
11/04/2016
C4396
C4396
7cd6b283-db17-4574-b299-03e0b913ad70

Compiler Warning (level 2) C4396

"name" : the inline specifier cannot be used when a friend declaration refers to a specialization of a function template

A specialization of a function template cannot specify any of the inline specifiers. The compiler issues warning C4396 and ignores the inline specifier.

To correct this error

  • Remove the inline, __inline, or __forceinline specifier from the friend function declaration.

Example

The following code example shows an invalid friend function declaration with an inline specifier.

// C4396.cpp
// compile with: /W2 /c

class X;
template<class T> void Func(T t, int i);

class X {
    friend inline void Func<char>(char t, int i);  //C4396
// try the following line instead
//    friend void Func<char>(char t, int i);
    int i;
};