[clang] a4beece - [clang] Add test for CWG2007

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 11 12:13:50 PDT 2023


Author: Vlad Serebrennikov
Date: 2023-04-11T22:13:43+03:00
New Revision: a4beecef8f40ad0d42f61e7c495acb2d2d819b10

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

LOG: [clang] Add test for CWG2007

[[https://wg21.link/p1787 | P1787]]: CWG2007 is resolved by skipping unqualified lookup for operators that must be member functions.
Wording: For the operators =, [], or ->, the set of non-member candidates is empty; otherwise, it includes the result of the unqualified lookup for operator at ... ([over.match.oper]/3)

Reviewed By: #clang-language-wg, shafik

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/test/CXX/drs/dr20xx.cpp b/clang/test/CXX/drs/dr20xx.cpp
index c167f41397c1..61fdb81854a4 100644
--- a/clang/test/CXX/drs/dr20xx.cpp
+++ b/clang/test/CXX/drs/dr20xx.cpp
@@ -3,12 +3,22 @@
 // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++2a -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2b -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 
 #if __cplusplus < 201103L
 #define static_assert(...) _Static_assert(__VA_ARGS__)
 #endif
 
+namespace dr2007 { // dr2007: 3.4
+template<typename T> struct A { typename T::error e; };
+template<typename T> struct B { };
+B<A<void> > b1;
+B<A<void> > b2 = b1;
+int a = b2[0]; // expected-error {{does not provide a subscript operator}}
+int b = __builtin_addressof(b2)->foo; // expected-error {{no member}}
+}
+
 namespace dr2026 { // dr2026: 11
   template<int> struct X {};
 

diff  --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index 863e20a57e2c..67350fa35938 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -11849,7 +11849,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
     <td><a href="https://wg21.link/cwg2007">2007</a></td>
     <td>CD6</td>
     <td>Argument-dependent lookup for <TT>operator=</TT></td>
-    <td class="none" align="center">Unknown</td>
+    <td class="full" align="center">Clang 3.4</td>
   </tr>
   <tr id="2008">
     <td><a href="https://wg21.link/cwg2008">2008</a></td>


        


More information about the cfe-commits mailing list