|
1 |
| -// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify=expected,cxx98 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors |
2 |
| -// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify=expected,cxx11-17,since-cxx11 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors |
3 |
| -// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify=expected,cxx11-17,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors |
4 |
| -// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify=expected,cxx11-17,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors |
5 |
| -// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx20,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors |
6 |
| -// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx20,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors |
7 |
| -// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify=expected,since-cxx20,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors |
| 1 | +// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-14,cxx98 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors |
| 2 | +// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-14,cxx11-17,since-cxx11 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors |
| 3 | +// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-14,cxx11-17,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors |
| 4 | +// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx17,cxx11-17,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors |
| 5 | +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx17,since-cxx20,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors |
| 6 | +// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx17,since-cxx20,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors |
| 7 | +// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify=expected,since-cxx17,since-cxx20,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors |
8 | 8 |
|
9 | 9 | #if __cplusplus == 199711L
|
10 | 10 | #define static_assert(...) __extension__ _Static_assert(__VA_ARGS__)
|
11 | 11 | // cxx98-error@-1 {{variadic macros are a C99 feature}}
|
12 | 12 | #endif
|
13 | 13 |
|
| 14 | +namespace dr1800 { // dr1800: 2.9 |
| 15 | +struct A { union { int n; }; }; |
| 16 | +static_assert(__is_same(__decltype(&A::n), int A::*), ""); |
| 17 | +} // namespace dr1800 |
| 18 | + |
| 19 | +namespace dr1801 { // dr1801: 2.8 |
| 20 | +static union { |
| 21 | + int i; |
| 22 | +}; |
| 23 | + |
| 24 | +template <int &> struct S {}; // #dr1801-S |
| 25 | +S<i> V; // #dr1801-S-i |
| 26 | +// cxx98-14-error@-1 {{non-type template argument does not refer to any declaration}} |
| 27 | +// cxx98-14-note@#dr1801-S {{template parameter is declared here}} |
| 28 | +// since-cxx17-error@#dr1801-S-i {{non-type template argument refers to subobject '.i'}} |
| 29 | +} |
| 30 | + |
| 31 | +namespace dr1802 { // dr1802: 3.1 |
| 32 | +#if __cplusplus >= 201103L |
| 33 | +// Using a Uncyclopedia example of surrogate pair: |
| 34 | +// https://en.wikipedia.org/wiki/UTF-16#Examples |
| 35 | +constexpr char16_t a[3] = u"\U00010437"; |
| 36 | +static_assert(a[0] == 0xD801, ""); |
| 37 | +static_assert(a[1] == 0xDC37, ""); |
| 38 | +static_assert(a[2] == 0x0, ""); |
| 39 | +#endif |
| 40 | +} // namespace dr1802 |
| 41 | + |
| 42 | +namespace dr1803 { // dr1803: 2.9 |
| 43 | +#if __cplusplus >= 201103L |
| 44 | +struct A { |
| 45 | + enum E : int; |
| 46 | + enum E : int {}; |
| 47 | + enum class EC; |
| 48 | + enum class EC {}; |
| 49 | + enum struct ES; |
| 50 | + enum struct ES {}; |
| 51 | +}; |
| 52 | +#endif |
| 53 | +} // namespace dr1803 |
| 54 | + |
| 55 | +namespace dr1804 { // dr1804: 2.7 |
| 56 | +template <typename, typename> |
| 57 | +struct A { |
| 58 | + void f1(); |
| 59 | + |
| 60 | + template <typename V> |
| 61 | + void f2(V); |
| 62 | + |
| 63 | + class B { |
| 64 | + void f3(); |
| 65 | + }; |
| 66 | + |
| 67 | + template <typename> |
| 68 | + class C { |
| 69 | + void f4(); |
| 70 | + }; |
| 71 | +}; |
| 72 | + |
| 73 | +template <typename U> |
| 74 | +struct A<int, U> { |
| 75 | + void f1(); |
| 76 | + |
| 77 | + template <typename V> |
| 78 | + void f2(V); |
| 79 | + |
| 80 | + class B { |
| 81 | + void f3(); |
| 82 | + }; |
| 83 | + |
| 84 | + template <typename> |
| 85 | + class C { |
| 86 | + void f4(); |
| 87 | + }; |
| 88 | +}; |
| 89 | + |
| 90 | +class D { |
| 91 | + int i; |
| 92 | + |
| 93 | + template <typename, typename> |
| 94 | + friend struct A; |
| 95 | +}; |
| 96 | + |
| 97 | +template <typename U> |
| 98 | +struct A<double, U> { |
| 99 | + void f1(); |
| 100 | + |
| 101 | + template <typename V> |
| 102 | + void f2(V); |
| 103 | + |
| 104 | + class B { |
| 105 | + void f3(); |
| 106 | + }; |
| 107 | + |
| 108 | + template <typename> |
| 109 | + class C { |
| 110 | + void f4(); |
| 111 | + }; |
| 112 | +}; |
| 113 | + |
| 114 | +template <typename U> |
| 115 | +void A<int, U>::f1() { |
| 116 | + D d; |
| 117 | + d.i = 0; |
| 118 | +} |
| 119 | + |
| 120 | +template <typename U> |
| 121 | +void A<double, U>::f1() { |
| 122 | + D d; |
| 123 | + d.i = 0; |
| 124 | +} |
| 125 | + |
| 126 | +template <typename U> |
| 127 | +template <typename V> |
| 128 | +void A<int, U>::f2(V) { |
| 129 | + D d; |
| 130 | + d.i = 0; |
| 131 | +} |
| 132 | + |
| 133 | +template <typename U> |
| 134 | +template <typename V> |
| 135 | +void A<double, U>::f2(V) { |
| 136 | + D d; |
| 137 | + d.i = 0; |
| 138 | +} |
| 139 | + |
| 140 | +template <typename U> |
| 141 | +void A<int, U>::B::f3() { |
| 142 | + D d; |
| 143 | + d.i = 0; |
| 144 | +} |
| 145 | + |
| 146 | +template <typename U> |
| 147 | +void A<double, U>::B::f3() { |
| 148 | + D d; |
| 149 | + d.i = 0; |
| 150 | +} |
| 151 | + |
| 152 | +template <typename U> |
| 153 | +template <typename V> |
| 154 | +void A<int, U>::C<V>::f4() { |
| 155 | + D d; |
| 156 | + d.i = 0; |
| 157 | +} |
| 158 | + |
| 159 | +template <typename U> |
| 160 | +template <typename V> |
| 161 | +void A<double, U>::C<V>::f4() { |
| 162 | + D d; |
| 163 | + d.i = 0; |
| 164 | +} |
| 165 | +} // namespace dr1804 |
| 166 | + |
14 | 167 | namespace dr1812 { // dr1812: no
|
15 | 168 | // NB: dup 1710
|
16 | 169 | #if __cplusplus >= 201103L
|
|
0 commit comments