共用方式為


編譯器錯誤 C3854

'=' 左邊的運算式會評估為函式。 無法指定函式 (函式不是 l 值)

備註

無法重新初始化參考。 取消參考函式會產生無法指派的右值函式。 因此,您無法透過函式的參考指派。

Example

下列範例會產生 C3854:

// C3854.cpp
int afunc(int i)
{
   return i;
}

typedef int (& rFunc_t)(int);
typedef int (* pFunc_t)(int);

int main()
{
   rFunc_t rf = afunc;   // OK binding a reference to function
   pFunc_t pf = &afunc;   // OK initializing a pointer to function

   *pf = &afunc;   // C3854
   // try the following line instead
   // pf = &afunc;
   *rf = &afunc;   // C3854
}