comparison gcc/testsuite/g++.dg/torture/pr90313.cc @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 // { dg-do run }
2
3 #include <stddef.h>
4
5 namespace std {
6 template<typename T, size_t N> struct array {
7 T elems[N];
8 const T &operator[](size_t i) const { return elems[i]; }
9 };
10 }
11
12 using Coordinates = std::array<double, 3>;
13
14 Coordinates map(const Coordinates &c, size_t level)
15 {
16 Coordinates result{ c[1], c[2], c[0] };
17
18 if (level != 0)
19 result = map (result, level - 1);
20
21 return result;
22 }
23
24 int main()
25 {
26 Coordinates vecOfCoordinates = { 1.0, 2.0, 3.0 };
27
28 auto result = map(vecOfCoordinates, 1);
29 if (result[0] != 3 || result[1] != 1 || result[2] != 2)
30 __builtin_abort ();
31
32 return 0;
33 }