[clang] [clang] Add test for CWG110 "Can template functions and classes be declared in the same scope?" (PR #111446)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 8 04:53:05 PDT 2024


https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/111446

>From 9e427888749e7fc77c0302742de971d69c8c2889 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Tue, 8 Oct 2024 00:58:48 +0300
Subject: [PATCH 1/2] [clang] Add test for CWG110

---
 clang/test/CXX/drs/cwg1xx.cpp | 10 ++++++++++
 clang/www/cxx_dr_status.html  |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/clang/test/CXX/drs/cwg1xx.cpp b/clang/test/CXX/drs/cwg1xx.cpp
index d6ee0844458b1d..39423eefc1873f 100644
--- a/clang/test/CXX/drs/cwg1xx.cpp
+++ b/clang/test/CXX/drs/cwg1xx.cpp
@@ -119,6 +119,16 @@ namespace cwg109 { // cwg109: yes
   };
 }
 
+namespace cwg110 { // cwg110: 2.8
+template <typename>
+void f();
+
+class f;
+
+template <typename>
+void f(int);
+} // namespace cwg110
+
 namespace cwg111 { // cwg111: dup 535
   struct A { A(); A(volatile A&, int = 0); A(A&, const char * = "foo"); };
   struct B : A { B(); }; // #cwg111-B
diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index ba63106ccc3875..1a67b6103cf43e 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -705,7 +705,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
     <td><a href="https://cplusplus.github.io/CWG/issues/110.html">110</a></td>
     <td>CD6</td>
     <td>Can template functions and classes be declared in the same scope?</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Clang 2.8</td>
   </tr>
   <tr id="111">
     <td><a href="https://cplusplus.github.io/CWG/issues/111.html">111</a></td>

>From 562fe8ea7baa6a7315bc4426a2727d6510f07f37 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Tue, 8 Oct 2024 14:52:47 +0300
Subject: [PATCH 2/2] Update the test according to Richard's suggestion

---
 clang/test/CXX/drs/cwg1xx.cpp | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/clang/test/CXX/drs/cwg1xx.cpp b/clang/test/CXX/drs/cwg1xx.cpp
index 39423eefc1873f..6aec8b65c91f12 100644
--- a/clang/test/CXX/drs/cwg1xx.cpp
+++ b/clang/test/CXX/drs/cwg1xx.cpp
@@ -120,13 +120,17 @@ namespace cwg109 { // cwg109: yes
 }
 
 namespace cwg110 { // cwg110: 2.8
-template <typename>
-void f();
+template <typename T>
+void f(T);
+
+class f {};
 
-class f;
+template <typename T>
+void f(T, T);
 
-template <typename>
-void f(int);
+class f g;
+void (*h)(int) = static_cast<void(*)(int)>(f);
+void (*i)(int, int) = static_cast<void(*)(int, int)>(f);
 } // namespace cwg110
 
 namespace cwg111 { // cwg111: dup 535



More information about the cfe-commits mailing list