File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99
1010#include < iostream>
1111#include < stdexcept>
12+ #include < type_traits>
1213
1314// [[deprecated("deadline:2020-12-31")]] // c+14 or later
1415[[gnu::deprecated]] // c+11 or later
1516int old_func ()
1617{
17- [[gnu::deprecated (" I hate this" )]]
18+ // [[gnu::deprecated("I hate this")]]
1819 int value = 0 ;
1920
2021 return value;
@@ -64,11 +65,35 @@ void case3()
6465 cout << " case3" << endl;
6566}
6667
68+ void case4 ()
69+ {
70+ static_assert (sizeof (long ) >= 8 , " must run on x64" );
71+ }
72+
73+ template <typename T>
74+ void check_type (T v)
75+ {
76+ using namespace std ;
77+
78+ static_assert (is_integral<T>::value, " int" );
79+ // static_assert(is_pointer<T>::value, "ptr");
80+ // static_assert(is_default_constructible<T>::value, "is_default_constructible");
81+
82+ cout << " static_assert : " << typeid (v).name () << endl;
83+
84+ cout << is_void<void >::value << endl;
85+ }
86+
6787int main ()
6888{
6989 old_func ();
7090 get_num ();
7191
7292 case2 ();
7393 case3 ();
94+
95+ case4 ();
96+
97+ check_type (10 );
98+ // check_type((void*)0);
7499}
You can’t perform that action at this time.
0 commit comments