Compiler Error C3485

Visual Studio 2015
 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Compiler Error C3485.

a lambda definition cannot have any cv-qualifiers

You cannot use a const or volatile qualifier as part of the definition of a lambda expression.

To correct this error

  • Remove the const or volatile qualifier from the definition of your lambda expression.

The following example generates C3485 because it uses the const qualifier as part of the definition of a lambda expression:

// C3485.cpp  
  
int main()  
{  
   auto x = []() const mutable {}; // C3485  
}  

Lambda Expressions

Show: