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
|
#include "app.hpp"
#include "chunk.hpp"
namespace floormat {
static inline bool always_false()
{
volatile bool ret = false;
return ret;
}
bool floormat::test_tile_iter() // NOLINT(readability-function-size)
{
if (always_false())
{
const chunk c;
for (const auto& [x, k, pt] : c)
static_assert(std::is_same_v<decltype(x), const tile&>);
for (auto& [x, k, pt] : c)
static_assert(std::is_same_v<decltype(x), const tile&>);
for (auto [x, k, pt] : c)
static_assert(std::is_same_v<decltype(x), const tile&>);
for (auto&& [x, k, pt] : c)
static_assert(std::is_same_v<decltype(x), const tile&>);
}
if (always_false())
{
chunk c;
for (auto& [x, k, pt] : c)
static_assert(std::is_same_v<decltype(x), tile&>);
for (const auto& [x, k, pt] : c)
static_assert(std::is_same_v<decltype(x), const tile&>);
for (auto [x, k, pt] : c)
static_assert(std::is_same_v<decltype(x), tile&>);
#if 0
// warns
for (const auto [x, k, pt] : c)
static_assert(std::is_same_v<decltype(x), const tile&>);
#endif
for (auto&& [x, k, pt] : c)
static_assert(std::is_same_v<decltype(x), tile&>);
#if 0
// fails to compile
for (const auto&& [x, k, pt] : c)
static_assert(std::is_same_v<decltype(x), const tile&>);
#endif
}
return true;
}
} // namespace floormat
|