Sdílet prostřednictvím


Chyba kompilátoru C3274

__finally/finally bez odpovídajícího pokusu

Poznámky

Byl nalezen příkaz __finally nebo finally bez shody try. Chcete-li tento problém vyřešit, odstraňte __finally příkaz nebo přidejte try příkaz pro __finally.

Example

Následující příklad generuje C3274:

// C3274.cpp
// compile with: /clr
// C3274 expected
using namespace System;
int main() {
   try {
      try {
         throw gcnew ApplicationException();
      }
      catch(...) {
         Console::Error->WriteLine(L"Caught an exception");
      }
      finally {
         Console::WriteLine(L"In finally");
      }
   } finally {
      Console::WriteLine(L"In finally");
   }

   // Uncomment the following 3 lines to resolve.
   // try {
   //   throw gcnew ApplicationException();
   // }

   finally {
      Console::WriteLine(L"In finally");
   }
   Console::WriteLine(L"**FAIL**");
}