Author: Vlad Serebrennikov
Date: 2023-04-14T10:15:21+03:00
New Revision: 576c752410e71229f271ec7defb22f3596338c00

URL: 
https://github.com/llvm/llvm-project/commit/576c752410e71229f271ec7defb22f3596338c00
DIFF: 
https://github.com/llvm/llvm-project/commit/576c752410e71229f271ec7defb22f3596338c00.diff

LOG: [clang] Add test for CWG1894 and CWG2199

[[https://wg21.link/p1787 | P1787]]: CWG1894 and its duplicate CWG2199 are 
resolved per Richard’s proposal for [[ 
https://listarchives.isocpp.org/cgi-bin/wg21/message?wg=core&msg=28415 | “dr407 
still leaves open questions about typedef / tag hiding” ]], using generic 
conflicting-declaration rules even for typedef, and discarding a redundant 
typedef-name when looking up an elaborated-type-specifier.
Wording: See changes to [dcl.typedef], [basic.lookup.elab], and 
[basic.lookup]/4.

Generic conflicting-declaration rules are specified in changes to 
[basic.scope.scope]. [[ https://cplusplus.github.io/CWG/issues/407.html | 
CWG407]], [[ https://cplusplus.github.io/CWG/issues/1894.html | CWG1894 ]], and 
[[ https://cplusplus.github.io/CWG/issues/2199.html | CWG2199 ]] discuss how 
elaborated type specifiers interact with typedefs, using directives, and using 
declarations. Since existing test for CWG407 covers examples provided in 
CWG1894 and CWG2199, and does it in accordance with P1787, I reused parts of it.

Reviewed By: #clang-language-wg, cor3ntin

Differential Revision: https://reviews.llvm.org/D148136

Added: 
    

Modified: 
    clang/test/CXX/drs/dr18xx.cpp
    clang/test/CXX/drs/dr21xx.cpp
    clang/test/CXX/drs/dr4xx.cpp
    clang/www/cxx_dr_status.html

Removed: 
    


################################################################################
diff  --git a/clang/test/CXX/drs/dr18xx.cpp b/clang/test/CXX/drs/dr18xx.cpp
index 02739cd2c0005..43db6e3a95a1f 100644
--- a/clang/test/CXX/drs/dr18xx.cpp
+++ b/clang/test/CXX/drs/dr18xx.cpp
@@ -168,3 +168,31 @@ void dr1891() { // dr1891: 4
   b = static_cast<B&&>(b); // expected-error {{copy assignment operator is 
implicitly deleted}}
 #endif
 }
+
+namespace dr1894 { // dr1894: 3.8
+                   // NB: reusing part of dr407 test
+namespace A {
+  struct S {};
+}
+namespace B {
+  typedef int S;
+}
+namespace E {
+  typedef A::S S;
+  using A::S;
+  struct S s;
+}
+namespace F {
+  typedef A::S S;
+}
+namespace G {
+  using namespace A;
+  using namespace F;
+  struct S s;
+}
+namespace H {
+  using namespace F;
+  using namespace A;
+  struct S s;
+}
+}

diff  --git a/clang/test/CXX/drs/dr21xx.cpp b/clang/test/CXX/drs/dr21xx.cpp
index d8cf3ac9f7eda..80db71bccc8db 100644
--- a/clang/test/CXX/drs/dr21xx.cpp
+++ b/clang/test/CXX/drs/dr21xx.cpp
@@ -1,7 +1,9 @@
 // RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++1z -triple x86_64-unknown-unknown %s -verify 
-fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify 
-fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2b -triple x86_64-unknown-unknown %s -verify 
-fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
 
 #if __cplusplus < 201103L
 // expected-error@+1 {{variadic macro}}
@@ -188,3 +190,31 @@ namespace dr2180 { // dr2180: yes
   B &B::operator=(B&&) = default; // expected-error {{would delete}} 
expected-note@-10{{inaccessible move assignment}}
 #endif
 }
+
+namespace dr2199 { // dr2199: 3.8
+                   // NB: reusing part of dr407 test
+namespace A {
+  struct S {};
+}
+namespace B {
+  typedef int S;
+}
+namespace E {
+  typedef A::S S;
+  using A::S;
+  struct S s;
+}
+namespace F {
+  typedef A::S S;
+}
+namespace G {
+  using namespace A;
+  using namespace F;
+  struct S s;
+}
+namespace H {
+  using namespace F;
+  using namespace A;
+  struct S s;
+}
+}

diff  --git a/clang/test/CXX/drs/dr4xx.cpp b/clang/test/CXX/drs/dr4xx.cpp
index 3617af8b683c0..f1ba2a0471389 100644
--- a/clang/test/CXX/drs/dr4xx.cpp
+++ b/clang/test/CXX/drs/dr4xx.cpp
@@ -124,6 +124,7 @@ namespace dr406 { // dr406: yes
 }
 
 namespace dr407 { // dr407: 3.8
+                  // NB: reused by dr1894 and dr2199
   struct S;
   typedef struct S S;
   void f() {

diff  --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index 47300efb99c36..ef45809d2d5a9 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -11171,7 +11171,7 @@ <h2 id="cxxdr">C++ defect report implementation 
status</h2>
     <td><a 
href="https://cplusplus.github.io/CWG/issues/1894.html";>1894</a></td>
     <td>CD6</td>
     <td><I>typedef-name</I>s and <I>using-declaration</I>s</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="full" align="center">Clang 3.8</td>
   </tr>
   <tr id="1895">
     <td><a 
href="https://cplusplus.github.io/CWG/issues/1895.html";>1895</a></td>
@@ -13001,7 +13001,7 @@ <h2 id="cxxdr">C++ defect report implementation 
status</h2>
     <td><a 
href="https://cplusplus.github.io/CWG/issues/2199.html";>2199</a></td>
     <td>CD6</td>
     <td>Typedefs and tags</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="full" align="center">Clang 3.8</td>
   </tr>
   <tr id="2200">
     <td><a 
href="https://cplusplus.github.io/CWG/issues/2200.html";>2200</a></td>


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to