Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- struct S {
- std::string a;
- S(S&& x) : a(std::move(x.a)) {}
- };
- struct Base {
- void f() {}
- };
- struct Derived : Base {
- // void f() override {} // CE
- };
- int main() {
- int a = 5;
- double& b = reinterpret_cast<double&>(a);
- b++; // UB
- std::cout << a << "\n";
- const int cx = 5;
- int& x = const_cast<int&>(cx);
- ++x; // UB
- std::cout << cx << "\n";
- std::cout << typeid("abc").name(); // string or char?
- // S el("aaaa"); // default copy constructor
- // S ell(el);
- // el = ell;
- int y = 5;
- int&& rr = std::move(y);
- int& rrr = rr;
- std::cout << y;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement