/
dr26xx.cpp
105 lines (85 loc) · 2.93 KB
/
dr26xx.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify
namespace dr2621 { // dr2621: yes
enum class E { a };
namespace One {
using E_t = E;
using enum E_t; // typedef ok
auto v = a;
}
namespace Two {
using dr2621::E;
int E; // we see this
using enum E; // expected-error {{unknown type name E}}
}
}
namespace dr2628 { // dr2628: yes open
template <bool A = false, bool B = false>
struct foo {
constexpr foo() requires (!A && !B) = delete; // #DR2628_CTOR
constexpr foo() requires (A || B) = delete;
};
void f() {
foo fooable; // expected-error {{call to deleted}}
// expected-note@#DR2628_CTOR {{marked deleted here}}
}
}
namespace dr2635 { // dr2635: 16
template<typename T>
concept UnaryC = true;
template<typename T, typename U>
concept BinaryC = true;
struct S{ int i, j; };
S get_S();
template<typename T>
T get_T();
void use() {
// expected-error@+1{{decomposition declaration cannot be declared with constrained 'auto'}}
UnaryC auto [a, b] = get_S();
// expected-error@+1{{decomposition declaration cannot be declared with constrained 'auto'}}
BinaryC<int> auto [c, d] = get_S();
}
template<typename T>
void TemplUse() {
// expected-error@+1{{decomposition declaration cannot be declared with constrained 'auto'}}
UnaryC auto [a, b] = get_T<T>();
// expected-error@+1{{decomposition declaration cannot be declared with constrained 'auto'}}
BinaryC<T> auto [c, d] = get_T<T>();
}
}
// dr2636: na
namespace dr2640 { // dr2640: 16
int \N{Λ} = 0; //expected-error {{'Λ' is not a valid Unicode character name}} \
//expected-error {{expected unqualified-id}}
const char* emoji = "\N{🤡}"; // expected-error {{'🤡' is not a valid Unicode character name}} \
// expected-note 5{{did you mean}}
#define z(x) 0
#define dr2640_a z(
int x = dr2640_a\N{abc}); // expected-error {{'abc' is not a valid Unicode character name}}
int y = dr2640_a\N{LOTUS}); // expected-error {{character <U+1FAB7> not allowed in an identifier}} \
// expected-error {{use of undeclared identifier 'dr2640_a🪷'}} \
// expected-error {{extraneous ')' before ';'}}
}
// dr2642: na
namespace dr2644 { // dr2644: yes
auto z = [a = 42](int a) { // expected-error {{a lambda parameter cannot shadow an explicitly captured entity}} \
// expected-note {{variable 'a' is explicitly captured here}}
return 1;
};
}
namespace dr2650 { // dr2650: yes
template <class T, T> struct S {};
template <class T> int f(S<T, T{}>*); // expected-note {{type 'X' of non-type template parameter is not a structural type}}
class X {
int m;
};
int i0 = f<X>(0); //expected-error {{no matching function for call to 'f'}}
}
namespace dr2654 { // dr2654: 16
void f() {
int neck, tail;
volatile int brachiosaur;
brachiosaur += neck; // OK
brachiosaur -= neck; // OK
brachiosaur |= neck; // OK
}
}