]> granicus.if.org Git - clang/commitdiff
Tests for DR150 - DR165.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 7 Nov 2013 06:24:09 +0000 (06:24 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 7 Nov 2013 06:24:09 +0000 (06:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194192 91177308-0d34-0410-b5e6-96231b3b80d8

test/CXX/drs/dr1xx.cpp
www/cxx_dr_status.html

index f8ea8d9b1ad12ec46931718865572e17c4a48b4b..646bc1b5ce97c2ec49680529ca0b6e4254b42728 100644 (file)
@@ -556,3 +556,117 @@ namespace dr148 { // dr148: yes
 }
 
 // dr149: na
+
+namespace dr151 { // dr151: yes
+  struct X {};
+  typedef int X::*p;
+#if __cplusplus < 201103L
+#define fold(x) (__builtin_constant_p(0) ? (x) : (x))
+#else
+#define fold
+#endif
+  int check[fold(p() == 0) ? 1 : -1];
+#undef fold
+}
+
+namespace dr152 { // dr152: yes
+  struct A {
+    A(); // expected-note {{not viable}}
+    explicit A(const A&);
+  };
+  A a1 = A(); // expected-error {{no matching constructor}}
+  A a2((A()));
+}
+
+// dr153: na
+
+namespace dr154 { // dr154: yes
+  union { int a; }; // expected-error {{must be declared 'static'}}
+  namespace {
+    union { int b; };
+  }
+  static union { int c; };
+}
+
+namespace dr155 { // dr155: dup 632
+  struct S { int n; } s = { { 1 } }; // expected-warning {{braces around scalar initializer}}
+}
+
+namespace dr159 { // dr159: no
+  namespace X { void f(); }
+  void f();
+  // FIXME: This should be accepted.
+  void dr159::f() {} // expected-error {{extra qualification}}
+  void dr159::X::f() {}
+}
+
+// dr160: na
+
+namespace dr161 { // dr161: yes
+  class A {
+  protected:
+    struct B { int n; } b; // expected-note 2{{here}}
+    static B bs;
+    void f(); // expected-note {{here}}
+    static void sf();
+  };
+  struct C : A {};
+  struct D : A {
+    void g(C c) {
+      (void)b.n;
+      B b1;
+      C::B b2; // ok, accessible as a member of A
+      (void)&C::b; // expected-error {{protected}}
+      (void)&C::bs;
+      (void)c.b; // expected-error {{protected}}
+      (void)c.bs;
+      f();
+      sf();
+      c.f(); // expected-error {{protected}}
+      c.sf();
+      A::f();
+      D::f();
+      A::sf();
+      C::sf();
+      D::sf();
+    }
+  };
+}
+
+namespace dr162 { // dr162: no
+  struct A {
+    char &f(char);
+    static int &f(int);
+
+    void g() {
+      int &a = (&A::f)(0); // FIXME: expected-error {{could not be resolved}}
+      char &b = (&A::f)('0'); // expected-error {{could not be resolved}}
+    }
+  };
+
+  int &c = (&A::f)(0); // FIXME: expected-error {{could not be resolved}}
+  char &d = (&A::f)('0'); // expected-error {{could not be resolved}}
+}
+
+// dr163: na
+
+namespace dr164 { // dr164: yes
+  void f(int);
+  template <class T> int g(T t) { return f(t); }
+
+  enum E { e };
+  int f(E);
+
+  int k = g(e);
+}
+
+namespace dr165 { // dr165: no
+  namespace N {
+    struct A { friend struct B; };
+    void f() { void g(); }
+  }
+  // FIXME: dr1477 says this is ok, dr165 says it's ill-formed
+  struct N::B {};
+  // FIXME: dr165 says this is ill-formed, but the argument in dr1477 says it's ok
+  void N::g() {}
+}
index d44047ad97148ee2d77672f195c42c8435c82413..8c4bde8eadc634c7992f319c6a8b1a48246676f5 100644 (file)
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#151">151</a></td>
     <td>TC1</td>
     <td>Terminology of zero-initialization</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#152">152</a></td>
     <td>TC1</td>
     <td><TT>explicit</TT> copy constructors</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#153">153</a></td>
     <td>TC1</td>
     <td>Misleading wording (rank of conversion)</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="na" align="center">N/A</td>
   </tr>
   <tr>
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#154">154</a></td>
     <td>NAD</td>
     <td>Anonymous unions in unnamed namespaces</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_closed.html#155">155</a></td>
     <td>dup</td>
     <td>Brace initializer for scalar</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="none" align="center">Duplicate of 632</td>
   </tr>
   <tr class="open">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#156">156</a></td>
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#159">159</a></td>
     <td>TC1</td>
     <td>Namespace qualification in declarators</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#160">160</a></td>
     <td>CD1</td>
     <td>Missing <TT>std::</TT> qualification</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="na" align="center">N/A</td>
   </tr>
   <tr>
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#161">161</a></td>
     <td>TC1</td>
     <td>Access to protected nested type</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#162">162</a></td>
     <td>CD1</td>
     <td>(<TT>&amp;C::f)()</TT> with nonstatic members</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#163">163</a></td>
     <td>TC1</td>
     <td>Description of subaggregate initializer</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="na" align="center">N/A</td>
   </tr>
   <tr>
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#164">164</a></td>
     <td>TC1</td>
     <td>Overlap between Koenig and normal lookup</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_closed.html#165">165</a></td>
     <td>NAD</td>
     <td>Definitions of friends and block-scope externs</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#166">166</a></td>