File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 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
1519void 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
102110auto get_a_set ()
Original file line number Diff line number Diff line change @@ -97,7 +97,11 @@ void case3()
9797 msgpack::sbuffer sbuf;
9898 msgpack::pack (sbuf, book1);
9999
100- auto obj = msgpack::unpack (sbuf.data (), sbuf.size ()).get ();
100+ // may cause std::bad_cast error
101+ // auto obj = msgpack::unpack(sbuf.data(), sbuf.size()).get();
102+
103+ auto handle = msgpack::unpack (sbuf.data (), sbuf.size ());
104+ auto obj = handle.get ();
101105
102106 Book book2;
103107 obj.convert (book2);
You can’t perform that action at this time.
0 commit comments