Skip to content

Commit

Permalink
[clang][NFC] Fix DR test ordering
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Endilll committed Apr 15, 2023
1 parent 4530c3b commit b9d84b5
Show file tree
Hide file tree
Showing 10 changed files with 205 additions and 206 deletions.
26 changes: 13 additions & 13 deletions clang/test/CXX/drs/dr10xx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
}
24 changes: 12 additions & 12 deletions clang/test/CXX/drs/dr13xx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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
6 changes: 3 additions & 3 deletions clang/test/CXX/drs/dr14xx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ namespace dr1423 { // dr1423: 11
#endif
}

// dr1425: na abi

namespace dr1432 { // dr1432: 16
#if __cplusplus >= 201103L
template<typename T> T declval();
Expand Down Expand Up @@ -64,8 +66,6 @@ struct A {
};
}

// dr1425: na abi

namespace dr1460 { // dr1460: 3.5
#if __cplusplus >= 201103L
namespace DRExample {
Expand Down Expand Up @@ -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.
Expand Down
34 changes: 17 additions & 17 deletions clang/test/CXX/drs/dr16xx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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@-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
Expand Down Expand Up @@ -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@-1 {{points past the end}}
}

namespace dr1653 { // dr1653: 4 c++17
void f(bool b) {
++b;
Expand Down Expand Up @@ -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 *'}}
Expand Down
36 changes: 18 additions & 18 deletions clang/test/CXX/drs/dr17xx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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@+2 {{invalid suffix on literal; C++11 requires a space between literal and identifier}}
// expected-warning@+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.
Expand All @@ -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@+2 {{invalid suffix on literal; C++11 requires a space between literal and identifier}}
// expected-warning@+1 {{user-defined literal suffixes not starting with '_' are reserved; no literal will invoke this operator}}
float operator ""E(const char *);
#endif
}
56 changes: 28 additions & 28 deletions clang/test/CXX/drs/dr20xx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
40 changes: 20 additions & 20 deletions clang/test/CXX/drs/dr22xx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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
Expand Down Expand Up @@ -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
}

0 comments on commit b9d84b5

Please sign in to comment.