[PATCH] D147839: [clang] Add test for CWG2007

Vlad Serebrennikov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 11 01:42:13 PDT 2023


Endill updated this revision to Diff 512365.
Endill added a comment.

Replace unary `&` with `__builtin_addressof()`. It prevents unnecessary template instantiation (presumably to find overloaded unary `&`), and make Clang compliant since 3.4


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147839/new/

https://reviews.llvm.org/D147839

Files:
  clang/test/CXX/drs/dr20xx.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
@@ -11849,7 +11849,7 @@
     <td><a href="https://wg21.link/cwg2007">2007</a></td>
     <td>CD6</td>
     <td>Argument-dependent lookup for <TT>operator=</TT></td>
-    <td class="partial" align="center">Partial</td>
+    <td class="full" align="center">Clang 3.4</td>
   </tr>
   <tr id="2008">
     <td><a href="https://wg21.link/cwg2008">2008</a></td>
Index: clang/test/CXX/drs/dr20xx.cpp
===================================================================
--- clang/test/CXX/drs/dr20xx.cpp
+++ clang/test/CXX/drs/dr20xx.cpp
@@ -10,14 +10,13 @@
 #define static_assert(...) _Static_assert(__VA_ARGS__)
 #endif
 
-namespace dr2007 { // dr2007: partial
+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}}
-// FIXME: the following code shouldn't instantiate A<void>.
-// int b = (&b2)->foo;
+int b = __builtin_addressof(b2)->foo; // expected-error {{no member}}
 }
 
 namespace dr2026 { // dr2026: 11


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147839.512365.patch
Type: text/x-patch
Size: 1261 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230411/d3ab40ce/attachment.bin>


More information about the cfe-commits mailing list