|
@@ -25,30 +25,27 @@ template <int N> struct index {};
|
|
void f(index<0>) {}
|
|
void f(index<0>) {}
|
|
|
|
|
|
int f(index<1>) { return 0; }
|
|
int f(index<1>) { return 0; }
|
|
-int const f(index<2>) { return 0; }
|
|
|
|
-int volatile f(index<3>) { return 0; }
|
|
|
|
-int const volatile f(index<4>) { return 0; }
|
|
|
|
|
|
|
|
-int & f(index<5>) { return static_cast<int &>(my_int); }
|
|
|
|
-int const & f(index<6>) { return static_cast<int const &>(my_int); }
|
|
|
|
-int volatile & f(index<7>) { return static_cast<int volatile &>(my_int); }
|
|
|
|
-int const volatile & f(index<8>) { return static_cast<int const volatile &>(my_int); }
|
|
|
|
|
|
+int & f(index<2>) { return static_cast<int &>(my_int); }
|
|
|
|
+int const & f(index<3>) { return static_cast<int const &>(my_int); }
|
|
|
|
+int volatile & f(index<4>) { return static_cast<int volatile &>(my_int); }
|
|
|
|
+int const volatile & f(index<5>) { return static_cast<int const volatile &>(my_int); }
|
|
|
|
|
|
-int && f(index<9>) { return static_cast<int &&>(my_int); }
|
|
|
|
-int const && f(index<10>) { return static_cast<int const &&>(my_int); }
|
|
|
|
-int volatile && f(index<11>) { return static_cast<int volatile &&>(my_int); }
|
|
|
|
-int const volatile && f(index<12>) { return static_cast<int const volatile &&>(my_int); }
|
|
|
|
|
|
+int && f(index<6>) { return static_cast<int &&>(my_int); }
|
|
|
|
+int const && f(index<7>) { return static_cast<int const &&>(my_int); }
|
|
|
|
+int volatile && f(index<8>) { return static_cast<int volatile &&>(my_int); }
|
|
|
|
+int const volatile && f(index<9>) { return static_cast<int const volatile &&>(my_int); }
|
|
|
|
|
|
-int * f(index<13>) { return static_cast<int *>(&my_int); }
|
|
|
|
-int const * f(index<14>) { return static_cast<int const *>(&my_int); }
|
|
|
|
-int volatile * f(index<15>) { return static_cast<int volatile *>(&my_int); }
|
|
|
|
-int const volatile * f(index<16>) { return static_cast<int const volatile *>(&my_int); }
|
|
|
|
|
|
+int * f(index<10>) { return static_cast<int *>(&my_int); }
|
|
|
|
+int const * f(index<11>) { return static_cast<int const *>(&my_int); }
|
|
|
|
+int volatile * f(index<12>) { return static_cast<int volatile *>(&my_int); }
|
|
|
|
+int const volatile * f(index<13>) { return static_cast<int const volatile *>(&my_int); }
|
|
|
|
|
|
|
|
|
|
template <int Func, class Expect>
|
|
template <int Func, class Expect>
|
|
void test()
|
|
void test()
|
|
{
|
|
{
|
|
- using F = decltype((f(index<Func>{})));
|
|
|
|
|
|
+ using F = decltype(f(index<Func>{}));
|
|
static_assert(std::is_same<F, Expect>::value, "");
|
|
static_assert(std::is_same<F, Expect>::value, "");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -58,19 +55,16 @@ int main()
|
|
{
|
|
{
|
|
test<0, void>();
|
|
test<0, void>();
|
|
test<1, int>();
|
|
test<1, int>();
|
|
- //test<2, int const>();
|
|
|
|
- //test<3, int volatile>();
|
|
|
|
- //test<4, int const volatile>();
|
|
|
|
- test<5, int &>();
|
|
|
|
- test<6, int const &>();
|
|
|
|
- test<7, int volatile &>();
|
|
|
|
- test<8, int const volatile &>();
|
|
|
|
- test<9, int &&>();
|
|
|
|
- test<10, int const &&>();
|
|
|
|
- test<11, int volatile &&>();
|
|
|
|
- test<12, int const volatile &&>();
|
|
|
|
- test<13, int *>();
|
|
|
|
- test<14, int const *>();
|
|
|
|
- test<15, int volatile *>();
|
|
|
|
- test<16, int const volatile *>();
|
|
|
|
|
|
+ test<2, int &>();
|
|
|
|
+ test<3, int const &>();
|
|
|
|
+ test<4, int volatile &>();
|
|
|
|
+ test<5, int const volatile &>();
|
|
|
|
+ test<6, int &&>();
|
|
|
|
+ test<7, int const &&>();
|
|
|
|
+ test<8, int volatile &&>();
|
|
|
|
+ test<9, int const volatile &&>();
|
|
|
|
+ test<10, int *>();
|
|
|
|
+ test<11, int const *>();
|
|
|
|
+ test<12, int volatile *>();
|
|
|
|
+ test<13, int const volatile *>();
|
|
}
|
|
}
|