Compiler Error C3484

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 C3484.

expected '->' before the return type

You must provide -> before the return type of a lambda expression.

To correct this error

  • Provide -> before the return type.

The following example generates C3484:

// C3484a.cpp  
  
int main()  
{  
   return []() . int { return 42; }(); // C3484  
}  

The following example resolves C3484 by providing -> before the return type of the lambda expression:

// C3484b.cpp  
  
int main()  
{  
   return []() -> int { return 42; }();  
}  

Lambda Expressions

Show: