共用方式為


編譯器錯誤 C3848

類型為 'type' 的表達式會遺失一些 const-volatile 限定符,以便呼叫 'function'

具有指定 const-volatile 類型的變數只能呼叫以相同或更大 const-volatile 限定性定義的成員函式。

下列範例會產生 C3848:

// C3848.cpp
void glbFunc1()
{
}

typedef void (* pFunc1)();

struct S3
{
   operator pFunc1() // const
   {
      return &glbFunc1;
   }
};

int main()
{
   const S3 s3;
   s3();   // C3848, uncomment const qualifier
}