[PATCH] D149003: [clang] Add test for CWG1821

Vlad Serebrennikov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 22 11:44:35 PDT 2023


Endill created this revision.
Endill added reviewers: shafik, clang-language-wg.
Herald added a project: All.
Endill requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

P1787 <https://wg21.link/p1787>: My clarification in “Where can namespace-scope functions and variables be redeclared?” <http://lists.isocpp.org/core/2019/06/6614.php> is applied, resolving CWG1821.
Wording: (If the declaration is not a friend declaration:) If the id-expression in a declarator-id is a qualified-id Q, let S be its lookup context; the declaration shall inhabit a namespace scope. ([dcl.meaning]/1)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149003

Files:
  clang/test/CXX/drs/dr18xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===================================================================
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -10733,7 +10733,7 @@
     <td><a href="https://cplusplus.github.io/CWG/issues/1821.html">1821</a></td>
     <td>CD6</td>
     <td>Qualified redeclarations in a class <I>member-specification</I></td>
-    <td class="none" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="1822">
     <td><a href="https://cplusplus.github.io/CWG/issues/1822.html">1822</a></td>
Index: clang/test/CXX/drs/dr18xx.cpp
===================================================================
--- clang/test/CXX/drs/dr18xx.cpp
+++ clang/test/CXX/drs/dr18xx.cpp
@@ -51,6 +51,22 @@
 #endif
 }
 
+namespace dr1821 { // dr1821: yes
+struct A {
+  template <typename> struct B {
+    void f();
+  };
+  template <typename T> void B<T>::f(){};
+  // expected-error at -1 {{non-friend class member 'f' cannot have a qualified name}}
+
+  struct C {
+    void f();
+  };
+  void C::f() {}
+  // expected-error at -1 {{non-friend class member 'f' cannot have a qualified name}}
+};
+} // namespace dr1821
+
 namespace dr1822 { // dr1822: yes
 #if __cplusplus >= 201103L
   int a;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149003.516093.patch
Type: text/x-patch
Size: 1254 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230422/e17d9374/attachment.bin>


More information about the cfe-commits mailing list