r200672 - Tests for DR321-330.

Richard Smith richard-llvm at metafoo.co.uk
Sun Feb 2 18:13:49 PST 2014


Author: rsmith
Date: Sun Feb  2 20:13:49 2014
New Revision: 200672

URL: http://llvm.org/viewvc/llvm-project?rev=200672&view=rev
Log:
Tests for DR321-330.

Modified:
    cfe/trunk/test/CXX/drs/dr3xx.cpp
    cfe/trunk/www/cxx_dr_status.html

Modified: cfe/trunk/test/CXX/drs/dr3xx.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/drs/dr3xx.cpp?rev=200672&r1=200671&r2=200672&view=diff
==============================================================================
--- cfe/trunk/test/CXX/drs/dr3xx.cpp (original)
+++ cfe/trunk/test/CXX/drs/dr3xx.cpp Sun Feb  2 20:13:49 2014
@@ -253,3 +253,88 @@ namespace dr320 { // dr320: yes
   static_assert(f(X()).copies == g(X()) + 1, "expected one extra copy for return value");
 #endif
 }
+
+namespace dr321 { // dr321: dup 557
+  namespace N {
+    template<int> struct A {
+      template<int> struct B;
+    };
+    template<> template<> struct A<0>::B<0>;
+    void f(A<0>::B<0>);
+  }
+  template<> template<> struct N::A<0>::B<0> {};
+
+  template<typename T> void g(T t) { f(t); }
+  template void g(N::A<0>::B<0>);
+
+  namespace N {
+    template<typename> struct I { friend bool operator==(const I&, const I&); };
+  }
+  N::I<int> i, j;
+  bool x = i == j;
+}
+
+namespace dr322 { // dr322: yes
+  struct A {
+    template<typename T> operator T&();
+  } a;
+  int &r = static_cast<int&>(a);
+  int &s = a;
+}
+
+// dr323: no
+
+namespace dr324 { // dr324: yes
+  struct S { int n : 1; } s; // expected-note 3{{bit-field is declared here}}
+  int &a = s.n; // expected-error {{non-const reference cannot bind to bit-field}}
+  int *b = &s.n; // expected-error {{address of bit-field}}
+  int &c = (s.n = 0); // expected-error {{non-const reference cannot bind to bit-field}}
+  int *d = &(s.n = 0); // expected-error {{address of bit-field}}
+  int &e = true ? s.n : s.n; // expected-error {{non-const reference cannot bind to bit-field}}
+  int *f = &(true ? s.n : s.n); // expected-error {{address of bit-field}}
+  int &g = (void(), s.n); // expected-error {{non-const reference cannot bind to bit-field}}
+  int *h = &(void(), s.n); // expected-error {{address of bit-field}}
+}
+
+namespace dr326 { // dr326: yes
+  struct S {};
+  int test[__is_trivially_constructible(S, const S&) ? 1 : -1];
+}
+
+namespace dr327 { // dr327: dup 538
+  struct A;
+  class A {};
+
+  class B;
+  struct B {};
+}
+
+namespace dr328 { // dr328: yes
+  struct A; // expected-note 3{{forward declaration}}
+  struct B { A a; }; // expected-error {{incomplete}}
+  template<typename> struct C { A a; }; // expected-error {{incomplete}}
+  A *p = new A[0]; // expected-error {{incomplete}}
+}
+
+namespace dr329 { // dr329: no
+  // FIXME: The C++98 behavior here is right, the C++11-onwards behavior
+  // is wrong.
+  struct B {};
+  template<typename T> struct A : B {
+    friend void f(A a) { g(a); }
+    friend void h(A a) { g(a); } // expected-error {{undeclared}}
+    friend void i(B b) {}
+  };
+  A<int> a;
+  A<char> b;
+#if __cplusplus < 201103L
+  // expected-error at -5 {{redefinition}} expected-note at -5 {{previous}}
+  // expected-note at -3 {{instantiation}}
+#endif
+
+  void test() {
+    h(a); // expected-note {{instantiation}}
+    i(a);
+    i(b);
+  }
+}

Modified: cfe/trunk/www/cxx_dr_status.html
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_dr_status.html?rev=200672&r1=200671&r2=200672&view=diff
==============================================================================
--- cfe/trunk/www/cxx_dr_status.html (original)
+++ cfe/trunk/www/cxx_dr_status.html Sun Feb  2 20:13:49 2014
@@ -1967,25 +1967,25 @@ of class templates</td>
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#321">321</a></td>
     <td>dup</td>
     <td>Associated classes and namespaces for argument-dependent lookup</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="none" align="center">Duplicate of 557</td>
   </tr>
   <tr>
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#322">322</a></td>
     <td>CD1</td>
     <td>Deduction of reference conversions</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr>
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#323">323</a></td>
     <td>CD1</td>
     <td>Where must <TT>export</TT> appear?</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="none" align="center">No</td>
   </tr>
   <tr>
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#324">324</a></td>
     <td>CD1</td>
     <td>Can "<TT>&</TT>" be applied to assignment to bit-field?</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr class="open">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#325">325</a></td>
@@ -1997,25 +1997,25 @@ of class templates</td>
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#326">326</a></td>
     <td>CD1</td>
     <td>Wording for definition of trivial constructor</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr>
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#327">327</a></td>
     <td>CD1</td>
     <td>Use of "structure" without definition</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="none" align="center">Duplicate of 538</td>
   </tr>
   <tr>
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#328">328</a></td>
     <td>CD1</td>
     <td>Missing requirement that class member types be complete</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr>
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#329">329</a></td>
     <td>CD1</td>
     <td>Evaluation of friends of templates</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="none" align="center">No</td>
   </tr>
   <tr class="open">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#330">330</a></td>





More information about the cfe-commits mailing list