r216953 - Tests for DR550-572.

Richard Smith richard-llvm at metafoo.co.uk
Tue Sep 2 14:29:16 PDT 2014


Author: rsmith
Date: Tue Sep  2 16:29:16 2014
New Revision: 216953

URL: http://llvm.org/viewvc/llvm-project?rev=216953&view=rev
Log:
Tests for DR550-572.

Modified:
    cfe/trunk/test/CXX/drs/dr3xx.cpp
    cfe/trunk/test/CXX/drs/dr5xx.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=216953&r1=216952&r2=216953&view=diff
==============================================================================
--- cfe/trunk/test/CXX/drs/dr3xx.cpp (original)
+++ cfe/trunk/test/CXX/drs/dr3xx.cpp Tue Sep  2 16:29:16 2014
@@ -366,7 +366,7 @@ namespace dr331 { // dr331: yes
   } const a, b(a); // expected-error {{no matching constructor}}
 }
 
-namespace dr332 { // dr332: dup 557
+namespace dr332 { // dr332: dup 577
   void f(volatile void); // expected-error {{'void' as parameter must not have type qualifiers}}
   void g(const void); // expected-error {{'void' as parameter must not have type qualifiers}}
   void h(int n, volatile void); // expected-error {{'void' must be the first and only parameter}}

Modified: cfe/trunk/test/CXX/drs/dr5xx.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/drs/dr5xx.cpp?rev=216953&r1=216952&r2=216953&view=diff
==============================================================================
--- cfe/trunk/test/CXX/drs/dr5xx.cpp (original)
+++ cfe/trunk/test/CXX/drs/dr5xx.cpp Tue Sep  2 16:29:16 2014
@@ -2,6 +2,11 @@
 // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++1y %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 
+// FIXME: This is included to avoid a diagnostic with no source location
+// pointing at the implicit operator new. We can't match such a diagnostic
+// with -verify.
+void *operator new(__SIZE_TYPE__); // expected-warning 0-1{{missing exception spec}} expected-note{{candidate}}
+
 namespace dr500 { // dr500: dup 372
   class D;
   class A {
@@ -528,3 +533,186 @@ namespace dr548 { // dr548: dup 482
   template struct dr548::S<int>;
   template void dr548::f<int>();
 }
+
+namespace dr551 { // dr551: yes c++11
+  // FIXME: This obviously should apply in C++98 mode too.
+  template<typename T> void f() {}
+  template inline void f<int>();
+#if __cplusplus >= 201103L
+  // expected-error at -2 {{cannot be 'inline'}}
+#endif
+
+  template<typename T> inline void g() {}
+  template inline void g<int>();
+#if __cplusplus >= 201103L
+  // expected-error at -2 {{cannot be 'inline'}}
+#endif
+
+  template<typename T> struct X {
+    void f() {}
+  };
+  template inline void X<int>::f();
+#if __cplusplus >= 201103L
+  // expected-error at -2 {{cannot be 'inline'}}
+#endif
+}
+
+namespace dr552 { // dr552: yes
+  template<typename T, typename T::U> struct X {};
+  struct Y { typedef int U; };
+  X<Y, 0> x;
+}
+
+struct dr553_class {
+  friend void *operator new(__SIZE_TYPE__, dr553_class);
+};
+namespace dr553 {
+  dr553_class c;
+  // Contrary to the apparent intention of the DR, operator new is not actually
+  // looked up with a lookup mechanism that performs ADL; the standard says it
+  // "is looked up in global scope", where it is not visible.
+  void *p = new (c) int; // expected-error {{no matching function}}
+
+  struct namespace_scope {
+    friend void *operator new(__SIZE_TYPE__, namespace_scope); // expected-error {{cannot be declared inside a namespace}}
+  };
+}
+
+// dr556: na
+
+namespace dr557 { // dr557: yes
+  template<typename T> struct S {
+    friend void f(S<T> *);
+    friend void g(S<S<T> > *);
+  };
+  void x(S<int> *p, S<S<int> > *q) {
+    f(p);
+    g(q);
+  }
+}
+
+namespace dr558 { // dr558: yes
+  wchar_t a = L'\uD7FF';
+  wchar_t b = L'\xD7FF';
+  wchar_t c = L'\uD800'; // expected-error {{invalid universal character}}
+  wchar_t d = L'\xD800';
+  wchar_t e = L'\uDFFF'; // expected-error {{invalid universal character}}
+  wchar_t f = L'\xDFFF';
+  wchar_t g = L'\uE000';
+  wchar_t h = L'\xE000';
+}
+
+template<typename> struct dr559 { typedef int T; dr559::T u; }; // dr559: yes
+
+namespace dr561 { // dr561: yes
+  template<typename T> void f(int);
+  template<typename T> void g(T t) {
+    f<T>(t);
+  }
+  namespace {
+    struct S {};
+    template<typename T> static void f(S);
+  }
+  void h(S s) {
+    g(s);
+  }
+}
+
+namespace dr564 { // dr564: yes
+  extern "C++" void f(int);
+  void f(int); // ok
+  extern "C++" { extern int n; }
+  int n; // ok
+}
+
+namespace dr565 { // dr565: yes
+  namespace N {
+    template<typename T> int f(T); // expected-note {{target}}
+  }
+  using N::f; // expected-note {{using}}
+  template<typename T> int f(T*);
+  template<typename T> void f(T);
+  template<typename T, int = 0> int f(T); // expected-error 0-1{{extension}}
+  template<typename T> int f(T, int = 0);
+  template<typename T> int f(T); // expected-error {{conflicts with}}
+}
+
+namespace dr566 { // dr566: yes
+#if __cplusplus >= 201103L
+  int check[int(-3.99) == -3 ? 1 : -1];
+#endif
+}
+
+// dr567: na
+
+namespace dr568 { // dr568: yes c++11
+  // FIXME: This is a DR issue against C++98, so should probably apply there
+  // too.
+  struct x { int y; };
+  class trivial : x {
+    x y;
+  public:
+    int n;
+  };
+  int check_trivial[__is_trivial(trivial) ? 1 : -1];
+
+  struct std_layout {
+    std_layout();
+    std_layout(const std_layout &);
+    ~std_layout();
+  private:
+    int n;
+  };
+  int check_std_layout[__is_standard_layout(std_layout) ? 1 : -1];
+
+  struct aggregate {
+    int x;
+    int y;
+    trivial t;
+    std_layout sl;
+  };
+  aggregate aggr = {};
+
+  void f(...);
+  void g(trivial t) { f(t); }
+#if __cplusplus < 201103L
+  // expected-error at -2 {{non-POD}}
+#endif
+
+  void jump() {
+    goto x;
+#if __cplusplus < 201103L
+    // expected-error at -2 {{protected scope}}
+    // expected-note at +2 {{non-POD}}
+#endif
+    trivial t;
+  x: ;
+  }
+}
+
+namespace dr569 { // dr569: yes c++11
+  // FIXME: This is a DR issue against C++98, so should probably apply there
+  // too.
+  ;;;;;
+#if __cplusplus < 201103L
+  // expected-error at -2 {{C++11 extension}}
+#endif
+}
+
+namespace dr570 { // dr570: dup 633
+  int n;
+  int &r = n; // expected-note {{previous}}
+  int &r = n; // expected-error {{redefinition}}
+}
+
+namespace dr571 { // dr571 unknown
+  // FIXME: Add a codegen test.
+  typedef int &ir;
+  int n;
+  const ir r = n; // expected-warning {{has no effect}} FIXME: Test if this has internal linkage.
+}
+
+namespace dr572 { // dr572: yes
+  enum E { a = 1, b = 2 };
+  int check[a + b == 3 ? 1 : -1];
+}

Modified: cfe/trunk/www/cxx_dr_status.html
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_dr_status.html?rev=216953&r1=216952&r2=216953&view=diff
==============================================================================
--- cfe/trunk/www/cxx_dr_status.html (original)
+++ cfe/trunk/www/cxx_dr_status.html Tue Sep  2 16:29:16 2014
@@ -1967,7 +1967,7 @@ 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">Duplicate of <a href="#557">557</a></td>
+    <td class="full" align="center">Duplicate of <a href="#557">557</a></td>
   </tr>
   <tr id="322">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#322">322</a></td>
@@ -2033,7 +2033,7 @@ of class templates</td>
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#332">332</a></td>
     <td>CD3</td>
     <td>cv-qualified <TT>void</TT> parameter types</td>
-    <td class="none" align="center">Duplicate of <a href="#557">557</a></td>
+    <td class="none" align="center">Duplicate of <a href="#577">577</a></td>
   </tr>
   <tr id="333">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#333">333</a></td>
@@ -3349,13 +3349,13 @@ and <I>POD class</I></td>
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#551">551</a></td>
     <td>CD1</td>
     <td>When is <TT>inline</TT> permitted in an explicit instantiation?</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="full" align="center">Yes (C++11 onwards)</td>
   </tr>
   <tr id="552">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#552">552</a></td>
     <td>NAD</td>
     <td>Use of <TT>typename</TT> in the type in a non-type <I>parameter-declaration</I></td>
-    <td class="none" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="553">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#553">553</a></td>
@@ -3379,25 +3379,25 @@ and <I>POD class</I></td>
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#556">556</a></td>
     <td>CD2</td>
     <td>Conflicting requirements for acceptable aliasing</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="na" align="center">N/A</td>
   </tr>
   <tr id="557">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#557">557</a></td>
     <td>CD1</td>
     <td>Does argument-dependent lookup cause template instantiation?</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="558">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#558">558</a></td>
     <td>CD1</td>
     <td>Excluded characters in universal character names</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="559">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#559">559</a></td>
     <td>CD1</td>
     <td>Editing error in issue 382 resolution</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr class="open" id="560">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#560">560</a></td>
@@ -3409,7 +3409,7 @@ and <I>POD class</I></td>
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#561">561</a></td>
     <td>CD2</td>
     <td>Internal linkage functions in dependent name lookup</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr class="open" id="562">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#562">562</a></td>
@@ -3427,43 +3427,43 @@ and <I>POD class</I></td>
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#564">564</a></td>
     <td>CD2</td>
     <td>Agreement of language linkage or <I>linkage-specification</I>s?</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="565">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#565">565</a></td>
     <td>CD3</td>
     <td>Conflict rules for <I>using-declaration</I>s naming function templates</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="566">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#566">566</a></td>
     <td>NAD</td>
     <td>Conversion of negative floating point values to integer type</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="567">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#567">567</a></td>
     <td>NAD</td>
     <td>Can <TT>size_t</TT> and <TT>ptrdiff_t</TT> be larger than <TT>long</TT>?</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="na" align="center">N/A</td>
   </tr>
   <tr id="568">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#568">568</a></td>
     <td>CD1</td>
     <td>Definition of POD is too strict</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="full" align="center">Yes (C++11 onwards)</td>
   </tr>
   <tr id="569">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#569">569</a></td>
     <td>CD2</td>
     <td>Spurious semicolons at namespace scope should be allowed</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="full" align="center">Yes (C++11 onwards)</td>
   </tr>
   <tr id="570">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#570">570</a></td>
     <td>CD2</td>
     <td>Are references subject to the ODR?</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="none" align="center">Duplicate of <a href="#633">633</a></td>
   </tr>
   <tr id="571">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#571">571</a></td>
@@ -3475,7 +3475,7 @@ and <I>POD class</I></td>
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#572">572</a></td>
     <td>C++11</td>
     <td>Standard conversions for non-built-in types</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="full" align="center">Yes</td>
   </tr>
   <tr id="573">
     <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#573">573</a></td>





More information about the cfe-commits mailing list