Edit

Share via


Compiler Error C2494

'keyword' cannot be called from within a filter expression or __finally/finally block

You cannot use keyword in a __finally or finally block.

The following sample generates C2494:

// C2494.cpp
#include <malloc.h>

int main() {
   __try {}
   __except ( _alloca(100), 1 ) {}   // C2494
   __try {}
   __finally {
      _alloca(100);   // C2494
   }
}

C2494 can also occur when using /clr.

// C2494b.cpp
// compile with: /clr
#include <malloc.h>

int main() {
   char * buf;
   try {}
   catch (char * buf2) {}
   finally {
      _alloca(100);   // C2494
   }
}