Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 1, 2024

Conversation

MitalAshok
Copy link
Contributor

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

This was implemented for Clang 3.5 by b63b6ee

@MitalAshok MitalAshok requested a review from Endilll as a code owner July 31, 2024 18:22
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Jul 31, 2024
@llvmbot
Copy link
Member

llvmbot commented Jul 31, 2024

@llvm/pr-subscribers-clang

Author: Mital Ashok (MitalAshok)

Changes

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

This was implemented for Clang 3.5 by b63b6ee


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

2 Files Affected:

  • (modified) clang/test/CXX/drs/cwg8xx.cpp (+6-1)
  • (modified) clang/www/cxx_dr_status.html (+1-1)
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@-1 {{'main' is not allowed to be deleted}}
+// cxx98-error@-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>

@Endilll Endilll changed the title [clang][Tests][NFC] Add CWG882 test (Defining main as deleted) [clang][NFC] Add CWG882 test (Defining main as deleted) Jul 31, 2024
// cwg882: 3.5
int main() = delete;
// expected-error@-1 {{'main' is not allowed to be deleted}}
// cxx98-error@-2 {{deleted function definitions are a C++11 extension}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@Endilll
Copy link
Contributor

Endilll commented Jul 31, 2024

Do you want this to be merged once CI passes?

@MitalAshok
Copy link
Contributor Author

@Endilll Yes, thanks!

@Endilll Endilll merged commit 3b3b891 into llvm:main Aug 1, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants