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.
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();
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
-}
}
#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() {
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
#endif
}
+// dr1425: na abi
+
namespace dr1432 { // dr1432: 16
#if __cplusplus >= 201103L
template<typename T> T declval();
};
}
-// dr1425: na abi
-
namespace dr1460 { // dr1460: 3.5
#if __cplusplus >= 201103L
namespace DRExample {
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.
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
#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;
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 *'}}
#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 {
#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.
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
-}
}
}
+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 {
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
-}
// 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() {
}
#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
}
#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
+}
// 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
}
#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
} // namespace dr2386
#endif
+// dr2385: na
+
namespace dr2387 { // dr2387: 9
#if __cplusplus >= 201402L
template<int> int a = 0;
#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 {};
}
+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;
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();
- }
-}
};
}
-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 {
}
#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
+}