comparison gcc/testsuite/g++.dg/cpp1z/inline-var3.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
2 // { dg-options "-g0" } 2 // { dg-options "-g0" }
3 // Verify that inline variables and static data members that aren't odr-used 3 // Verify that inline variables and static data members that aren't odr-used
4 // aren't emitted into assembly even at -O0. 4 // aren't emitted into assembly even at -O0.
5 // { dg-final { scan-assembler-not "inlvarvariable" } } 5 // { dg-final { scan-assembler-not "inlvarvariable" } }
6 6
7 inline int inlvarvariable1 = 1; // { dg-warning "inline variables are only available with" "" { target c++14_down } } 7 inline int inlvarvariable1 = 1; // { dg-warning "1:inline variables are only available with" "" { target c++14_down } }
8 const inline int inlvarvariable2 = 2; // { dg-warning "inline variables are only available with" "" { target c++14_down } } 8 const inline int inlvarvariable2 = 2; // { dg-warning "7:inline variables are only available with" "" { target c++14_down } }
9 namespace N 9 namespace N
10 { 10 {
11 int inline inlvarvariable3; // { dg-warning "inline variables are only available with" "" { target c++14_down } } 11 int inline inlvarvariable3; // { dg-warning "7:inline variables are only available with" "" { target c++14_down } }
12 const int inline inlvarvariable4 = 4; // { dg-warning "inline variables are only available with" "" { target c++14_down } } 12 const int inline inlvarvariable4 = 4; // { dg-warning "13:inline variables are only available with" "" { target c++14_down } }
13 } 13 }
14 struct S 14 struct S
15 { 15 {
16 static inline double inlvarvariable5 = 5.0; // { dg-warning "inline variables are only available with" "" { target c++14_down } } 16 static inline double inlvarvariable5 = 5.0; // { dg-warning "10:inline variables are only available with" "" { target c++14_down } }
17 #if __cplusplus >= 201103L 17 #if __cplusplus >= 201103L
18 static constexpr int inlvarvariable6 = 6; 18 static constexpr int inlvarvariable6 = 6;
19 static inline constexpr int inlvarvariable7 = 7; // { dg-warning "inline variables are only available with" "" { target { c++11 && c++14_down } } } 19 static inline constexpr int inlvarvariable7 = 7; // { dg-warning "10:inline variables are only available with" "" { target { c++11 && c++14_down } } }
20 #endif 20 #endif
21 }; 21 };
22 template <int N> // { dg-warning "variable templates only available with" "" { target c++11_down } .+1 } 22 template <int N> // { dg-warning "variable templates only available with" "" { target c++11_down } .+1 }
23 inline int inlvarvariable8; // { dg-warning "inline variables are only available with" "" { target c++14_down } } 23 inline int inlvarvariable8; // { dg-warning "1:inline variables are only available with" "" { target c++14_down } }
24 template <int N> // { dg-warning "variable templates only available with" "" { target c++11_down } .+1 } 24 template <int N> // { dg-warning "variable templates only available with" "" { target c++11_down } .+1 }
25 const int inline inlvarvariable9 = 9; // { dg-warning "inline variables are only available with" "" { target c++14_down } } 25 const int inline inlvarvariable9 = 9; // { dg-warning "11:inline variables are only available with" "" { target c++14_down } }
26 namespace N 26 namespace N
27 { 27 {
28 template <int N> // { dg-warning "variable templates only available with" "" { target c++11_down } .+1 } 28 template <int N> // { dg-warning "variable templates only available with" "" { target c++11_down } .+1 }
29 int inline inlvarvariable10 = 10; // { dg-warning "inline variables are only available with" "" { target c++14_down } } 29 int inline inlvarvariable10 = 10; // { dg-warning "7:inline variables are only available with" "" { target c++14_down } }
30 template <int N> // { dg-warning "variable templates only available with" "" { target c++11_down } .+1 } 30 template <int N> // { dg-warning "variable templates only available with" "" { target c++11_down } .+1 }
31 const inline double inlvarvariable11 = 11.0; // { dg-warning "inline variables are only available with" "" { target c++14_down } } 31 const inline double inlvarvariable11 = 11.0; // { dg-warning "9:inline variables are only available with" "" { target c++14_down } }
32 } 32 }
33 template <int N> 33 template <int N>
34 struct T 34 struct T
35 { 35 {
36 static inline int inlvarvariable12 = 12; // { dg-warning "inline variables are only available with" "" { target c++14_down } } 36 static inline int inlvarvariable12 = 12; // { dg-warning "10:inline variables are only available with" "" { target c++14_down } }
37 #if __cplusplus >= 201103L 37 #if __cplusplus >= 201103L
38 static constexpr int inlvarvariable13 = 13; 38 static constexpr int inlvarvariable13 = 13;
39 static inline constexpr double inlvarvariable14 = 14.0; // { dg-warning "inline variables are only available with" "" { target { c++11 && c++14_down } } } 39 static inline constexpr double inlvarvariable14 = 14.0; // { dg-warning "10:inline variables are only available with" "" { target { c++11 && c++14_down } } }
40 #endif 40 #endif
41 }; 41 };
42 #if __cplusplus < 201103L 42 #if __cplusplus < 201103L
43 #define decltype(x) int 43 #define decltype(x) int
44 #endif 44 #endif