Skip to content

Commit 8d29d56

Browse files
committed
test04.cpp
1 parent 54d5d4a commit 8d29d56

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

section1/test04.cpp

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
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
1516
int 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+
6787
int 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
}

0 commit comments

Comments
 (0)