[clang] f5993fc - [clang] Add test for CWG36

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 1 10:11:07 PST 2022


Author: Vlad Serebrennikov
Date: 2022-12-01T21:10:28+03:00
New Revision: f5993fc7757e37a9076c5cd22de8f275e5c6097e

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

LOG: [clang] Add test for CWG36

Reviewed By: #clang-language-wg, aaron.ballman, erichkeane

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

Added: 
    

Modified: 
    clang/test/CXX/drs/dr0xx.cpp
    clang/www/cxx_dr_status.html

Removed: 
    


################################################################################
diff  --git a/clang/test/CXX/drs/dr0xx.cpp b/clang/test/CXX/drs/dr0xx.cpp
index 2959f4ebba91..e34dc75a1b6c 100644
--- a/clang/test/CXX/drs/dr0xx.cpp
+++ b/clang/test/CXX/drs/dr0xx.cpp
@@ -2,6 +2,8 @@
 // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
 // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
 // RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
+// RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
+// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
 
 namespace dr1 { // dr1: no
   namespace X { extern "C" void dr1_f(int a = 1); }
@@ -448,6 +450,94 @@ namespace dr33 { // dr33: yes
 
 // dr34: na
 // dr35: dup 178
+
+namespace dr36 { // dr36: yes
+namespace example1 {
+  namespace A {
+    int i;
+  }
+  
+  namespace A1 {
+    using A::i;
+    using A::i;
+  }
+  
+  void f()
+  {
+    using A::i;
+    using A::i;
+  }
+}
+
+namespace example2 {
+  struct A
+  {
+    int i;
+    static int j;
+  };
+
+  struct B : A { };
+  struct C : A { };
+
+  struct D : virtual B, virtual C
+  {
+    using B::i; // expected-note {{previous using declaration}}
+    using B::i; // expected-error {{redeclaration of using declaration}}
+
+    using C::i; // expected-note {{previous using declaration}}
+    using C::i; // expected-error {{redeclaration of using declaration}}
+
+    using B::j; // expected-note {{previous using declaration}}
+    using B::j; // expected-error {{redeclaration of using declaration}}
+
+    using C::j; // expected-note {{previous using declaration}}
+    using C::j; // expected-error {{redeclaration of using declaration}}
+  };
+}
+
+namespace example3 {
+  template<typename T>
+  struct A
+  {
+    T i;
+    static T j;
+  };
+
+  template<typename T>
+  struct B : A<T> { };
+  template<typename T>
+  struct C : A<T> { };
+
+  template<typename T>
+  struct D : virtual B<T>, virtual C<T>
+  {
+    using B<T>::i; // expected-note {{previous using declaration}}
+    using B<T>::i; // expected-error {{redeclaration of using declaration}}
+
+    using C<T>::i; // expected-note {{previous using declaration}}
+    using C<T>::i; // expected-error {{redeclaration of using declaration}}
+
+    using B<T>::j; // expected-note {{previous using declaration}}
+    using B<T>::j; // expected-error {{redeclaration of using declaration}}
+
+    using C<T>::j; // expected-note {{previous using declaration}}
+    using C<T>::j; // expected-error {{redeclaration of using declaration}}
+  };
+}
+namespace example4 {
+  template<typename T>
+  struct E {
+    T k;
+  };
+
+  template<typename T>
+  struct G : E<T> {
+    using E<T>::k; // expected-note {{previous using declaration}}
+    using E<T>::k; // expected-error {{redeclaration of using declaration}}
+  };
+}
+}
+
 // dr37: sup 475
 
 namespace dr38 { // dr38: yes
@@ -699,6 +789,8 @@ namespace dr58 { // dr58: yes
 }
 
 namespace dr59 { // dr59: yes
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-volatile"
   template<typename T> struct convert_to { operator T() const; };
   struct A {}; // expected-note 5+{{candidate}}
   struct B : A {}; // expected-note 0+{{candidate}}
@@ -732,6 +824,7 @@ namespace dr59 { // dr59: yes
   int n3 = convert_to<const int>();
   int n4 = convert_to<const volatile int>();
   int n5 = convert_to<const volatile int&>();
+#pragma clang diagnostic pop
 }
 
 namespace dr60 { // dr60: yes

diff  --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index e4d0a24e08c9..6fa7ead4138d 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -254,7 +254,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
     <td><a href="https://wg21.link/cwg36">36</a></td>
     <td>CD6</td>
     <td><I>using-declaration</I>s in multiple-declaration contexts</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="37">
     <td><a href="https://wg21.link/cwg37">37</a></td>


        


More information about the cfe-commits mailing list