[clang] [clang][NFC] Add CWG882 test (Defining `main` as deleted) (PR #101382)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 31 12:14:37 PDT 2024


================
@@ -30,3 +30,8 @@ void g(int i) {
 }
 #endif
 } // namespace cwg873
+
+// cwg882: 3.5
+int main() = delete;
+// expected-error at -1 {{'main' is not allowed to be deleted}}
+// cxx98-error at -2 {{deleted function definitions are a C++11 extension}}
----------------
Endilll wrote:

`delete` came in C++11, so you should guard the test with `#ifdef __cplusplus`

https://github.com/llvm/llvm-project/pull/101382


More information about the cfe-commits mailing list