Commit f281d34
committed
[Clang][Sema] Print more static_assert exprs
This change introspects more values involved in a static_assert, and
extends the supported set of operators for introspection to include
binary operator method calls.
It's intended to address the use-case where a small static_assert helper
looks something like this (via `constexpr-builtin-bit-cast.cpp`):
```c++
struct int_splicer {
unsigned x;
unsigned y;
constexpr bool operator==(const int_splicer &other) const {
return other.x == x && other.y == y;
}
};
```
When used like so:
```c++
constexpr int_splicer got{1, 2};
constexpr int_splicer want{3, 4};
static_assert(got == want);
```
Then we'd expect to get the error:
```
Static assertion failed due to requirement 'got == want'
```
And this change adds the helpful note:
```
Expression evaluates to '{1, 2} == {3, 4}'
```1 parent db3bc49 commit f281d34
File tree
5 files changed
+40
-25
lines changed- clang
- lib/Sema
- test
- CXX
- class/class.compare
- class.eq
- class.rel
- over/over.match/over.match.funcs/over.match.oper
- SemaCXX
5 files changed
+40
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17219 | 17219 | | |
17220 | 17220 | | |
17221 | 17221 | | |
| 17222 | + | |
| 17223 | + | |
| 17224 | + | |
| 17225 | + | |
| 17226 | + | |
| 17227 | + | |
| 17228 | + | |
17222 | 17229 | | |
17223 | 17230 | | |
17224 | 17231 | | |
| |||
17256 | 17263 | | |
17257 | 17264 | | |
17258 | 17265 | | |
17259 | | - | |
17260 | | - | |
17261 | | - | |
17262 | | - | |
17263 | | - | |
| 17266 | + | |
| 17267 | + | |
| 17268 | + | |
| 17269 | + | |
17264 | 17270 | | |
17265 | 17271 | | |
17266 | 17272 | | |
| |||
17287 | 17293 | | |
17288 | 17294 | | |
17289 | 17295 | | |
17290 | | - | |
17291 | | - | |
17292 | | - | |
| 17296 | + | |
| 17297 | + | |
| 17298 | + | |
17293 | 17299 | | |
| 17300 | + | |
| 17301 | + | |
| 17302 | + | |
| 17303 | + | |
| 17304 | + | |
| 17305 | + | |
| 17306 | + | |
| 17307 | + | |
| 17308 | + | |
17294 | 17309 | | |
17295 | 17310 | | |
17296 | 17311 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
0 commit comments