次の方法で共有


コンパイラ エラー C3274

__finally/finally に対応する try がありません

__finally または finally ステートメントに対応する tryがありません。 これを解決するには、 __finally ステートメントを削除するか、または try に対して __finallyステートメントを追加します。

次の例では 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**");
}