[clang] b9d84b5 - [clang][NFC] Fix DR test ordering

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 15 08:25:15 PDT 2023


Author: Vlad Serebrennikov
Date: 2023-04-15T18:25:08+03:00
New Revision: b9d84b57f680cb294da906a6eeca2d0598c11568

URL: https://github.com/llvm/llvm-project/commit/b9d84b57f680cb294da906a6eeca2d0598c11568
DIFF: https://github.com/llvm/llvm-project/commit/b9d84b57f680cb294da906a6eeca2d0598c11568.diff

LOG: [clang][NFC] Fix DR test ordering

Some C++ DR tests are disrupting the usual ascending order, introducing confusion, and making people put new tests in the wrong place (myself included). This change affects 15 tests out of roughly 700.

Added: 
    

Modified: 
    clang/test/CXX/drs/dr10xx.cpp
    clang/test/CXX/drs/dr13xx.cpp
    clang/test/CXX/drs/dr14xx.cpp
    clang/test/CXX/drs/dr16xx.cpp
    clang/test/CXX/drs/dr17xx.cpp
    clang/test/CXX/drs/dr20xx.cpp
    clang/test/CXX/drs/dr22xx.cpp
    clang/test/CXX/drs/dr23xx.cpp
    clang/test/CXX/drs/dr26xx.cpp
    clang/test/CXX/drs/dr9xx.cpp

Removed: 
    


################################################################################
diff  --git a/clang/test/CXX/drs/dr10xx.cpp b/clang/test/CXX/drs/dr10xx.cpp
index 4d49a1859c2f5..76b0e0876d7a0 100644
--- a/clang/test/CXX/drs/dr10xx.cpp
+++ b/clang/test/CXX/drs/dr10xx.cpp
@@ -37,6 +37,19 @@ namespace dr1004 { // dr1004: 5
   Third<A<int> > t; // expected-note {{in instantiation of default argument}}
 }
 
+namespace dr1042 { // dr1042: 3.5
+#if __cplusplus >= 201402L
+  // C++14 added an attribute that we can test the semantics of.
+  using foo [[deprecated]] = int; // expected-note {{'foo' has been explicitly marked deprecated here}}
+  foo f = 12; // expected-warning {{'foo' is deprecated}}
+#elif __cplusplus >= 201103L
+  // C++11 did not have any attributes that could be applied to an alias
+  // declaration, so the best we can test is that we accept an empty attribute
+  // list in this mode.
+  using foo [[]] = int;
+#endif
+}
+
 namespace dr1048 { // dr1048: 3.6
   struct A {};
   const A f();
@@ -85,16 +98,3 @@ namespace dr1070 { // dr1070: 3.5
   C c = {};
 #endif
 }
-
-namespace dr1042 { // dr1042: 3.5
-#if __cplusplus >= 201402L
-  // C++14 added an attribute that we can test the semantics of.
-  using foo [[deprecated]] = int; // expected-note {{'foo' has been explicitly marked deprecated here}}
-  foo f = 12; // expected-warning {{'foo' is deprecated}}
-#elif __cplusplus >= 201103L
-  // C++11 did not have any attributes that could be applied to an alias
-  // declaration, so the best we can test is that we accept an empty attribute
-  // list in this mode.
-  using foo [[]] = int;
-#endif
-}

diff  --git a/clang/test/CXX/drs/dr13xx.cpp b/clang/test/CXX/drs/dr13xx.cpp
index 1a792f838e87c..65eb8a293276f 100644
--- a/clang/test/CXX/drs/dr13xx.cpp
+++ b/clang/test/CXX/drs/dr13xx.cpp
@@ -23,6 +23,18 @@ int complete = alignof(Complete(&)[]);
 }
 #endif
 
+namespace dr1307 { // dr1307: 14
+#if __cplusplus >= 201103L
+void f(int const (&)[2]);
+void f(int const (&)[3]);
+
+void caller() {
+  // This should not be ambiguous, the 2nd overload is better.
+  f({1, 2, 3});
+}
+#endif // __cplusplus >= 201103L
+} // namespace dr1307
+
 namespace dr1310 { // dr1310: 5
   struct S {} * sp = new S::S; // expected-error {{qualified reference to 'S' is a constructor name}}
   void f() {
@@ -476,15 +488,3 @@ namespace dr1399 { // dr1399: dup 1388
     f(0, 0, 0); // expected-error {{no match}}
   }
 }
-
-namespace dr1307 { // dr1307: 14
-#if __cplusplus >= 201103L
-void f(int const (&)[2]);
-void f(int const (&)[3]);
-
-void caller() {
-  // This should not be ambiguous, the 2nd overload is better.
-  f({1, 2, 3});
-}
-#endif // __cplusplus >= 201103L
-} // namespace dr1307

diff  --git a/clang/test/CXX/drs/dr14xx.cpp b/clang/test/CXX/drs/dr14xx.cpp
index 7d27d3b542443..9d667db9945fd 100644
--- a/clang/test/CXX/drs/dr14xx.cpp
+++ b/clang/test/CXX/drs/dr14xx.cpp
@@ -36,6 +36,8 @@ namespace dr1423 { // dr1423: 11
 #endif
 }
 
+// dr1425: na abi
+
 namespace dr1432 { // dr1432: 16
 #if __cplusplus >= 201103L
   template<typename T> T declval();
@@ -64,8 +66,6 @@ struct A {
 };
 }
 
-// dr1425: na abi
-
 namespace dr1460 { // dr1460: 3.5
 #if __cplusplus >= 201103L
   namespace DRExample {
@@ -493,7 +493,7 @@ namespace dr1490 {  // dr1490: 3.7 c++11
 
   char s[4]{"abc"};                   // Ok
   std::initializer_list<char>{"abc"}; // expected-error {{expected unqualified-id}}}
-} // dr190
+} // dr1490
 
 namespace dr1495 { // dr1495: 4
   // Deduction succeeds in both directions.

diff  --git a/clang/test/CXX/drs/dr16xx.cpp b/clang/test/CXX/drs/dr16xx.cpp
index 6f8ced5668f79..463353dab3b16 100644
--- a/clang/test/CXX/drs/dr16xx.cpp
+++ b/clang/test/CXX/drs/dr16xx.cpp
@@ -42,23 +42,6 @@ namespace dr1611 { // dr1611: dup 1658
   C c;
 }
 
-namespace dr1652 { // dr1652: 3.6
-  int a, b;
-  int arr[&a + 1 == &b ? 1 : 2]; // expected-error 2{{variable length array}}
-                                 // expected-note at -1 {{points past the end}}
-}
-
-namespace dr1684 { // dr1684: 3.6
-#if __cplusplus >= 201103L
-  struct NonLiteral { // expected-note {{because}}
-    NonLiteral();
-    constexpr int f() { return 0; } // expected-warning 0-1{{will not be implicitly 'const'}}
-  };
-  constexpr int f(NonLiteral &) { return 0; }
-  constexpr int f(NonLiteral) { return 0; } // expected-error {{not a literal type}}
-#endif
-}
-
 namespace dr1631 {  // dr1631: 3.7
 #if __cplusplus >= 201103L
   // Incorrect overload resolution for single-element initializer-list
@@ -131,6 +114,12 @@ namespace dr1645 { // dr1645: 3.9
 #endif
 }
 
+namespace dr1652 { // dr1652: 3.6
+  int a, b;
+  int arr[&a + 1 == &b ? 1 : 2]; // expected-error 2{{variable length array}}
+                                 // expected-note at -1 {{points past the end}}
+}
+
 namespace dr1653 { // dr1653: 4 c++17
   void f(bool b) {
     ++b;
@@ -283,6 +272,17 @@ namespace dr1672 { // dr1672: 7
   static_assert(!__is_standard_layout(Y<X>), "");
 }
 
+namespace dr1684 { // dr1684: 3.6
+#if __cplusplus >= 201103L
+  struct NonLiteral { // expected-note {{because}}
+    NonLiteral();
+    constexpr int f() { return 0; } // expected-warning 0-1{{will not be implicitly 'const'}}
+  };
+  constexpr int f(NonLiteral &) { return 0; }
+  constexpr int f(NonLiteral) { return 0; } // expected-error {{not a literal type}}
+#endif
+}
+
 namespace dr1687 { // dr1687: 7
   template<typename T> struct To {
     operator T(); // expected-note 2{{first operand was implicitly converted to type 'int *'}}

diff  --git a/clang/test/CXX/drs/dr17xx.cpp b/clang/test/CXX/drs/dr17xx.cpp
index b5ee7122ab3cb..e91f4a6d69b3a 100644
--- a/clang/test/CXX/drs/dr17xx.cpp
+++ b/clang/test/CXX/drs/dr17xx.cpp
@@ -27,6 +27,18 @@ namespace dr1715 { // dr1715: 3.9
 #endif
 }
 
+namespace dr1722 { // dr1722: 9
+#if __cplusplus >= 201103L
+void f() {
+  const auto lambda = [](int x) { return x + 1; };
+  // Without the DR applied, this static_assert would fail.
+  static_assert(
+      noexcept((int (*)(int))(lambda)),
+      "Lambda-to-function-pointer conversion is expected to be noexcept");
+}
+#endif
+} // namespace dr1722
+
 namespace dr1734 { // dr1734: no
 #if __cplusplus >= 201103L
 struct A {
@@ -111,17 +123,14 @@ namespace dr1758 { // dr1758: 3.7
 #endif
 }
 
-namespace dr1722 { // dr1722: 9
+namespace dr1762 { // dr1762: 14
 #if __cplusplus >= 201103L
-void f() {
-  const auto lambda = [](int x) { return x + 1; };
-  // Without the DR applied, this static_assert would fail.
-  static_assert(
-      noexcept((int (*)(int))(lambda)),
-      "Lambda-to-function-pointer conversion is expected to be noexcept");
-}
+  float operator ""_E(const char *);
+  // expected-error at +2 {{invalid suffix on literal; C++11 requires a space between literal and identifier}}
+  // expected-warning at +1 {{user-defined literal suffixes not starting with '_' are reserved; no literal will invoke this operator}}
+  float operator ""E(const char *);
 #endif
-} // namespace dr1722
+}
 
 namespace dr1778 { // dr1778: 9
   // Superseded by P1286R2.
@@ -137,12 +146,3 @@ namespace dr1778 { // dr1778: 9
   static_assert(noexcept(D()), "");
 #endif
 }
-
-namespace dr1762 { // dr1762: 14
-#if __cplusplus >= 201103L
-  float operator ""_E(const char *);
-  // expected-error at +2 {{invalid suffix on literal; C++11 requires a space between literal and identifier}}
-  // expected-warning at +1 {{user-defined literal suffixes not starting with '_' are reserved; no literal will invoke this operator}}
-  float operator ""E(const char *);
-#endif
-}

diff  --git a/clang/test/CXX/drs/dr20xx.cpp b/clang/test/CXX/drs/dr20xx.cpp
index 61fdb81854a44..2d3398cda5413 100644
--- a/clang/test/CXX/drs/dr20xx.cpp
+++ b/clang/test/CXX/drs/dr20xx.cpp
@@ -59,6 +59,34 @@ namespace dr2026 { // dr2026: 11
   }
 }
 
+namespace dr2061 { // dr2061: yes
+#if __cplusplus >= 201103L
+  namespace A {
+    inline namespace b {
+      namespace C {
+        // 'f' is the example from the DR.  'S' is an example where if we didn't
+        // properly handle the two being the same, we would get an incomplete
+        // type error during attempted instantiation.
+        template<typename T> void f();
+        template<typename T> struct S;
+      }
+    }
+  }
+
+  namespace A {
+    namespace C {
+      template<> void f<int>() { }
+      template<> struct S<int> { };
+    }
+  }
+
+  void use() {
+    A::C::f<int>();
+    A::C::S<int> s;
+  }
+#endif // C++11
+}
+
 namespace dr2076 { // dr2076: 13
 #if __cplusplus >= 201103L
   namespace std_example {
@@ -320,31 +348,3 @@ namespace dr2094 { // dr2094: 5
   static_assert(__is_trivially_assignable(A, const A&), "");
   static_assert(__is_trivially_assignable(B, const B&), "");
 }
-
-namespace dr2061 { // dr2061: yes
-#if __cplusplus >= 201103L
-  namespace A {
-    inline namespace b {
-      namespace C {
-        // 'f' is the example from the DR.  'S' is an example where if we didn't
-        // properly handle the two being the same, we would get an incomplete
-        // type error during attempted instantiation.
-        template<typename T> void f();
-        template<typename T> struct S;
-      }
-    }
-  }
-
-  namespace A {
-    namespace C {
-      template<> void f<int>() { }
-      template<> struct S<int> { };
-    }
-  }
-
-  void use() {
-    A::C::f<int>();
-    A::C::S<int> s;
-  }
-#endif // C++11
-}

diff  --git a/clang/test/CXX/drs/dr22xx.cpp b/clang/test/CXX/drs/dr22xx.cpp
index 91be4b53cb47a..c14c1f1e7c7a9 100644
--- a/clang/test/CXX/drs/dr22xx.cpp
+++ b/clang/test/CXX/drs/dr22xx.cpp
@@ -3,19 +3,6 @@
 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++1z -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 
-namespace dr2229 { // dr2229: 7
-struct AnonBitfieldQualifiers {
-  const unsigned : 1; // expected-error {{anonymous bit-field cannot have qualifiers}}
-  volatile unsigned : 1; // expected-error {{anonymous bit-field cannot have qualifiers}}
-  const volatile unsigned : 1; // expected-error {{anonymous bit-field cannot have qualifiers}}
-
-  unsigned : 1;
-  const unsigned i1 : 1;
-  volatile unsigned i2 : 1;
-  const volatile unsigned i3 : 1;
-};
-}
-
 #if __cplusplus >= 201103L
 namespace dr2211 { // dr2211: 8
 void f() {
@@ -27,13 +14,17 @@ void f() {
 }
 #endif
 
-namespace dr2292 { // dr2292: 9
-#if __cplusplus >= 201103L
-  template<typename T> using id = T;
-  void test(int *p) {
-    p->template id<int>::~id<int>();
-  }
-#endif
+namespace dr2229 { // dr2229: 7
+struct AnonBitfieldQualifiers {
+  const unsigned : 1; // expected-error {{anonymous bit-field cannot have qualifiers}}
+  volatile unsigned : 1; // expected-error {{anonymous bit-field cannot have qualifiers}}
+  const volatile unsigned : 1; // expected-error {{anonymous bit-field cannot have qualifiers}}
+
+  unsigned : 1;
+  const unsigned i1 : 1;
+  volatile unsigned i2 : 1;
+  const volatile unsigned i3 : 1;
+};
 }
 
 namespace dr2233 { // dr2233: 11
@@ -123,3 +114,12 @@ namespace CheckAfterMerging2 {
 }
 #endif
 } // namespace dr2233
+
+namespace dr2292 { // dr2292: 9
+#if __cplusplus >= 201103L
+  template<typename T> using id = T;
+  void test(int *p) {
+    p->template id<int>::~id<int>();
+  }
+#endif
+}

diff  --git a/clang/test/CXX/drs/dr23xx.cpp b/clang/test/CXX/drs/dr23xx.cpp
index c77df0a72f5e6..ac448994c6932 100644
--- a/clang/test/CXX/drs/dr23xx.cpp
+++ b/clang/test/CXX/drs/dr23xx.cpp
@@ -5,6 +5,39 @@
 // RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
 // RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
 
+#if __cplusplus >= 201103L
+namespace dr2303 { // dr2303: 12
+template <typename... T>
+struct A;
+template <>
+struct A<> {};
+template <typename T, typename... Ts>
+struct A<T, Ts...> : A<Ts...> {};
+struct B : A<int, int> {};
+struct C : A<int, int>, A<int> {}; // expected-warning {{direct base 'A<int>' is inaccessible}}
+struct D : A<int>, A<int, int> {}; // expected-warning {{direct base 'A<int>' is inaccessible}}
+struct E : A<int, int> {};
+struct F : B, E {};
+
+template <typename... T>
+void f(const A<T...> &) {
+  static_assert(sizeof...(T) == 2, "Should only match A<int,int>");
+}
+template <typename... T>
+void f2(const A<T...> *);
+
+void g() {
+  f(B{}); // This is no longer ambiguous.
+  B b;
+  f2(&b);
+  f(C{});
+  f(D{});
+  f(F{}); // expected-error {{ambiguous conversion from derived class}}
+}
+} //namespace dr2303
+#endif
+
+// dr2331: na
 
 #if __cplusplus >= 201103L
 namespace dr2338 { // dr2338: 12
@@ -101,6 +134,20 @@ namespace dr2358 { // dr2358: 16
 }
 #endif
 
+namespace dr2370 { // dr2370: no
+namespace N {
+typedef int type;
+void g(type);
+void h(type);
+} // namespace N
+class C {
+  typedef N::type N_type;
+  // FIXME: `type` should be searched for in N
+  // friend void N::g(type);
+  friend void N::h(N_type);
+};
+} // namespace dr2370
+
 #if __cplusplus >= 201707L
 // Otherwise, if the qualified-id std::tuple_size<E> names a complete class
 // type **with a member value**, the expression std::tuple_size<E>::value shall
@@ -122,6 +169,8 @@ void wrong_value() { auto [x, y] = Bad2(); } // expected-error {{decomposes into
 } // namespace dr2386
 #endif
 
+// dr2385: na
+
 namespace dr2387 { // dr2387: 9
 #if __cplusplus >= 201402L
   template<int> int a = 0;
@@ -139,56 +188,6 @@ namespace dr2387 { // dr2387: 9
 #endif
 }
 
-#if __cplusplus >= 201103L
-namespace dr2303 { // dr2303: 12
-template <typename... T>
-struct A;
-template <>
-struct A<> {};
-template <typename T, typename... Ts>
-struct A<T, Ts...> : A<Ts...> {};
-struct B : A<int, int> {};
-struct C : A<int, int>, A<int> {}; // expected-warning {{direct base 'A<int>' is inaccessible}}
-struct D : A<int>, A<int, int> {}; // expected-warning {{direct base 'A<int>' is inaccessible}}
-struct E : A<int, int> {};
-struct F : B, E {};
-
-template <typename... T>
-void f(const A<T...> &) {
-  static_assert(sizeof...(T) == 2, "Should only match A<int,int>");
-}
-template <typename... T>
-void f2(const A<T...> *);
-
-void g() {
-  f(B{}); // This is no longer ambiguous.
-  B b;
-  f2(&b);
-  f(C{});
-  f(D{});
-  f(F{}); // expected-error {{ambiguous conversion from derived class}}
-}
-} //namespace dr2303
-#endif
-
-// dr2331: na
-
-namespace dr2370 { // dr2370: no
-namespace N {
-typedef int type;
-void g(type);
-void h(type);
-} // namespace N
-class C {
-  typedef N::type N_type;
-  // FIXME: `type` should be searched for in N
-  // friend void N::g(type);
-  friend void N::h(N_type);
-};
-} // namespace dr2370
-
-// dr2385: na
-
 namespace dr2394 { // dr2394: 15
 
 struct A {};

diff  --git a/clang/test/CXX/drs/dr26xx.cpp b/clang/test/CXX/drs/dr26xx.cpp
index f2ec677297d22..175e27e6e2ed6 100644
--- a/clang/test/CXX/drs/dr26xx.cpp
+++ b/clang/test/CXX/drs/dr26xx.cpp
@@ -36,6 +36,22 @@ void f() {
 
 }
 
+namespace dr2631 { // dr2631: 16
+  constexpr int g();
+  consteval int f() {
+    return g();
+  }
+  int k(int x = f()) {
+    return x;
+  }
+  constexpr int g() {
+    return 42;
+  }
+  int test() {
+    return k();
+  }
+}
+
 namespace dr2635 { // dr2635: 16
 template<typename T>
 concept UnaryC = true;
@@ -110,19 +126,3 @@ void f() {
     brachiosaur |= neck;                // OK
 }
 }
-
-namespace dr2631 { // dr2631: 16
-  constexpr int g();
-  consteval int f() {
-    return g();
-  }
-  int k(int x = f()) {
-    return x;
-  }
-  constexpr int g() {
-    return 42;
-  }
-  int test() {
-    return k();
-  }
-}

diff  --git a/clang/test/CXX/drs/dr9xx.cpp b/clang/test/CXX/drs/dr9xx.cpp
index cce0b6ecf2095..2c1d620c6e4bf 100644
--- a/clang/test/CXX/drs/dr9xx.cpp
+++ b/clang/test/CXX/drs/dr9xx.cpp
@@ -14,35 +14,6 @@ namespace std {
   };
 }
 
-namespace dr990 { // dr990: 3.5
-#if __cplusplus >= 201103L
-  struct A { // expected-note 2{{candidate}}
-    A(std::initializer_list<int>); // expected-note {{candidate}}
-  };
-  struct B {
-    A a;
-  };
-  B b1 { };
-  B b2 { 1 }; // expected-error {{no viable conversion from 'int' to 'A'}}
-  B b3 { { 1 } };
-
-  struct C {
-    C();
-    C(int);
-    C(std::initializer_list<int>) = delete; // expected-note {{here}}
-  };
-  C c1[3] { 1 }; // ok
-  C c2[3] { 1, {2} }; // expected-error {{call to deleted}}
-
-  struct D {
-    D();
-    D(std::initializer_list<int>);
-    D(std::initializer_list<double>);
-  };
-  D d{};
-#endif
-}
-
 namespace dr948 { // dr948: 3.7
 #if __cplusplus >= 201103L
   class A {
@@ -118,3 +89,32 @@ namespace dr974 { // dr974: yes
   }
 #endif
 }
+
+namespace dr990 { // dr990: 3.5
+#if __cplusplus >= 201103L
+  struct A { // expected-note 2{{candidate}}
+    A(std::initializer_list<int>); // expected-note {{candidate}}
+  };
+  struct B {
+    A a;
+  };
+  B b1 { };
+  B b2 { 1 }; // expected-error {{no viable conversion from 'int' to 'A'}}
+  B b3 { { 1 } };
+
+  struct C {
+    C();
+    C(int);
+    C(std::initializer_list<int>) = delete; // expected-note {{here}}
+  };
+  C c1[3] { 1 }; // ok
+  C c2[3] { 1, {2} }; // expected-error {{call to deleted}}
+
+  struct D {
+    D();
+    D(std::initializer_list<int>);
+    D(std::initializer_list<double>);
+  };
+  D d{};
+#endif
+}


        


More information about the cfe-commits mailing list