Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Error C3848

expression having type 'type' would lose some const-volatile qualifiers in order to call 'function'

A variable with a specified const-volatile type can only call member functions defined with same or greater const-volatile qualifications.

The following samples generate 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
}

Community Additions

ADD
Show:
© 2015 Microsoft