Endill created this revision.
Endill added reviewers: erichkeane, shafik.
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>: The intent for CWG2335 (contra those of the 
older CWG1890, CWG1626, CWG1255, and CWG287) is supported by retaining the 
unrestricted forward lookup in complete-class contexts (despite current 
implementation behavior for non-templates).
Wording: The declaration set is the result of a single search in the scope of C 
for N from immediately after the class-specifier of C if P is in a 
complete-class context of C or from P otherwise. [Drafting note: The plan for 
CWG2335 is to describe forbidden dependency cycles among the complete-class 
contexts of a class. — end drafting note] ([class.member.lookup]/4)

Complete-class context is described in [class.mem.general] p7 
<http://eel.is/c++draft/class#mem.general-7> and p8 
<http://eel.is/c++draft/class#mem.general-8>. In this patch I add tests only 
for CWG issues that fall under current definition of complete-class context, 
because I'm not sure how CWG1255 and CWG287 are going to work. That's why I 
skip over them, but mark CWG1308 as superseded by CWG1330.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148433

Files:
  clang/test/CXX/drs/dr13xx.cpp
  clang/test/CXX/drs/dr16xx.cpp
  clang/test/CXX/drs/dr18xx.cpp
  clang/test/CXX/drs/dr23xx.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
@@ -2661,7 +2661,7 @@
     <td><a href="https://cplusplus.github.io/CWG/issues/437.html";>437</a></td>
     <td>CD1</td>
     <td>Is type of class allowed in member function exception specification?</td>
-    <td class="none" align="center">Superseded by <a href="#1308">1308</a></td>
+    <td class="full" align="center">Superseded by <a href="#1308">1308</a></td>
   </tr>
   <tr id="438">
     <td><a href="https://cplusplus.github.io/CWG/issues/438.html";>438</a></td>
@@ -7655,7 +7655,7 @@
     <td><a href="https://cplusplus.github.io/CWG/issues/1308.html";>1308</a></td>
     <td>CD3</td>
     <td>Completeness of class type within an <I>exception-specification</I></td>
-    <td class="none" align="center">Unknown</td>
+    <td class="full" align="center">Superseded by <a href="#1330">1330</a></td>
   </tr>
   <tr id="1309">
     <td><a href="https://cplusplus.github.io/CWG/issues/1309.html";>1309</a></td>
@@ -9563,7 +9563,7 @@
     <td><a href="https://cplusplus.github.io/CWG/issues/1626.html";>1626</a></td>
     <td>open</td>
     <td><TT>constexpr</TT> member functions in <I>brace-or-equal-initializer</I>s</td>
-    <td align="center">Not resolved</td>
+    <td class="none" align="center">No</td>
   </tr>
   <tr id="1627">
     <td><a href="https://cplusplus.github.io/CWG/issues/1627.html";>1627</a></td>
@@ -11147,7 +11147,7 @@
     <td><a href="https://cplusplus.github.io/CWG/issues/1890.html";>1890</a></td>
     <td>drafting</td>
     <td>Member type depending on definition of member function</td>
-    <td align="center">Not resolved</td>
+    <td class="none" align="center">No</td>
   </tr>
   <tr id="1891">
     <td><a href="https://cplusplus.github.io/CWG/issues/1891.html";>1891</a></td>
@@ -13817,7 +13817,7 @@
     <td><a href="https://cplusplus.github.io/CWG/issues/2335.html";>2335</a></td>
     <td>drafting</td>
     <td>Deduced return types vs member types</td>
-    <td align="center">Not resolved</td>
+    <td class="none" align="center">No</td>
   </tr>
   <tr id="2336">
     <td><a href="https://cplusplus.github.io/CWG/issues/2336.html";>2336</a></td>
Index: clang/test/CXX/drs/dr23xx.cpp
===================================================================
--- clang/test/CXX/drs/dr23xx.cpp
+++ clang/test/CXX/drs/dr23xx.cpp
@@ -39,6 +39,43 @@
 
 // dr2331: na
 
+namespace dr2335 { // dr2335: no drafting
+// FIXME: all of the examples are well-formed.
+#if __cplusplus >= 201402L
+namespace ex1 {
+template <class...> struct partition_indices {
+  static auto compute_right() {}
+  static constexpr auto right = compute_right;
+};
+template struct partition_indices<int>;
+} // namespace ex1
+
+namespace ex2 {
+template <int> struct X {};
+template <class T> struct partition_indices {
+  static auto compute_right() { return X<I>(); }
+  static constexpr auto right = compute_right;
+  static constexpr int I = sizeof(T);
+  // expected-error@-3 {{no member 'I' in 'dr2335::ex2::partition_indices<int>'; it has not yet been instantiated}}
+  // expected-note@-3 {{in instantiation of member function 'dr2335::ex2::partition_indices<int>::compute_right' requested here}}
+  // expected-note@+3 {{in instantiation of template class 'dr2335::ex2::partition_indices<int>' requested here}}
+  // expected-note@-4 {{not-yet-instantiated member is declared here}}
+};
+template struct partition_indices<int>;
+} // namespace ex2
+
+namespace ex3 {
+struct partition_indices {
+  static auto compute_right() {}
+  static constexpr auto right = compute_right;
+  // expected-error@-1 {{function 'compute_right' with deduced return type cannot be used before it is defined}}
+  // expected-note@-3 {{'compute_right' declared here}}
+  // expected-error@-3 {{declaration of variable 'right' with deduced type 'const auto' requires an initializer}}
+};
+} // namespace ex3
+#endif
+} // namespace dr2335
+
 #if __cplusplus >= 201103L
 namespace dr2338 { // dr2338: 12
 namespace B {
Index: clang/test/CXX/drs/dr18xx.cpp
===================================================================
--- clang/test/CXX/drs/dr18xx.cpp
+++ clang/test/CXX/drs/dr18xx.cpp
@@ -136,6 +136,34 @@
   static_assert(!__is_standard_layout(D), "");
 }
 
+namespace dr1890 { // dr1890: no drafting
+// FIXME: all the examples are well-formed.
+namespace ex1 {
+#if __cplusplus >= 201402L
+struct A {
+  struct B {
+    auto foo() { return 0; }
+  };
+  decltype(B().foo()) x;
+  // expected-error@-1 {{function 'foo' with deduced return type cannot be used before it is defined}}
+  // expected-note@-4 {{'foo' declared here}}
+};
+#endif
+} // namespace ex1
+
+namespace ex2 {
+#if __cplusplus >= 201103L
+struct Bar {
+  struct Baz {
+    int a = 0;
+  };
+  static_assert(__is_constructible(Baz), "");
+  // expected-error@-1 {{static assertion failed}}
+};
+#endif
+} // namespace ex2
+} // namespace dr1890
+
 void dr1891() { // dr1891: 4
 #if __cplusplus >= 201103L
   int n;
Index: clang/test/CXX/drs/dr16xx.cpp
===================================================================
--- clang/test/CXX/drs/dr16xx.cpp
+++ clang/test/CXX/drs/dr16xx.cpp
@@ -42,6 +42,28 @@
   C c;
 }
 
+namespace dr1626 { // dr1626: no open
+// FIXME: all of the examples are well-formed
+#if __cplusplus >= 201103L
+namespace ex1 {
+template <typename T> struct C {
+  template <typename T2> static constexpr bool _S_chk() { return false; }
+  static const bool __value = _S_chk<int>();
+};
+template struct C<double>;
+} // namespace ex1
+
+namespace ex2 {
+struct C {
+  static constexpr bool _S_chk() { return false; }
+  static const bool __value = _S_chk();
+  // expected-error@-1 {{in-class initializer for static data member is not a constant expression}}
+};
+C c;
+} // namespace ex2
+#endif
+} // namespace dr1626
+
 namespace dr1631 {  // dr1631: 3.7
 #if __cplusplus >= 201103L
   // Incorrect overload resolution for single-element initializer-list
Index: clang/test/CXX/drs/dr13xx.cpp
===================================================================
--- clang/test/CXX/drs/dr13xx.cpp
+++ clang/test/CXX/drs/dr13xx.cpp
@@ -35,6 +35,8 @@
 #endif // __cplusplus >= 201103L
 } // namespace dr1307
 
+// dr1308: sup 1330
+
 namespace dr1310 { // dr1310: 5
   struct S {} * sp = new S::S; // expected-error {{qualified reference to 'S' is a constructor name}}
   void f() {
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to