Skip to content

Commit ab5db0c

Browse files
committed
auto.cpp
1 parent 316e0bd commit ab5db0c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

section2/auto.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@
44
// g++ auto.cpp -std=c++14 -o a.out;./a.out
55
// g++ auto.cpp -std=c++14 -I../common -o a.out;./a.out
66

7+
#include <cassert>
8+
79
#include <iostream>
810
#include <string>
911
#include <vector>
1012
#include <set>
1113
#include <map>
1214

15+
#include <type_traits>
16+
1317
#include <signal.h>
1418

1519
void case1()
@@ -97,6 +101,10 @@ void case6()
97101
decltype(auto) x1 = (x);
98102
decltype(auto) x2 = &x;
99103
decltype(auto) x3 = x1;
104+
105+
assert(std::is_lvalue_reference<decltype(x1)>::value);
106+
assert(std::is_pointer<decltype(x2)>::value);
107+
assert(std::is_lvalue_reference<decltype(x3)>::value);
100108
}
101109

102110
auto get_a_set()

0 commit comments

Comments
 (0)