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

Mital Ashok via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 31 11:23:04 PDT 2024


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

https://cplusplus.github.io/CWG/issues/882.html

This was implemented for Clang 3.5 by b63b6ee9a00ef0710d899df6cfda78a1b8bd762a

>From 9dcbd0779bf379bbf62bf52247ef46de82cb4877 Mon Sep 17 00:00:00 2001
From: Mital Ashok <mital at mitalashok.co.uk>
Date: Wed, 31 Jul 2024 19:18:09 +0100
Subject: [PATCH] [clang][Tests][NFC] Add CWG882 test (Defining `main` as
 deleted)

---
 clang/test/CXX/drs/cwg8xx.cpp | 7 ++++++-
 clang/www/cxx_dr_status.html  | 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/clang/test/CXX/drs/cwg8xx.cpp b/clang/test/CXX/drs/cwg8xx.cpp
index c8cbdfcee3f4d..86ee1c0c86b0d 100644
--- a/clang/test/CXX/drs/cwg8xx.cpp
+++ b/clang/test/CXX/drs/cwg8xx.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-17 -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-17,cxx98 -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
@@ -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}}
diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index 937f67981e296..0b3477fbd217b 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -5161,7 +5161,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
     <td><a href="https://cplusplus.github.io/CWG/issues/882.html">882</a></td>
     <td>CD2</td>
     <td>Defining <TT>main</TT> as deleted</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Clang 3.5</td>
   </tr>
   <tr id="883">
     <td><a href="https://cplusplus.github.io/CWG/issues/883.html">883</a></td>



More information about the cfe-commits mailing list