Sorry, sent to wrong mail list. ________________________________________ From: Feng Xue OS Sent: Friday, May 14, 2021 4:30 PM To: gcc-patc...@gcc.gnu.org Subject: Question about non-POD class type
For an instance of a non-POD class, can I always assume that any operation on it should be type-safe, any wrong or even trick code to violate this is UB in C++ spec? For example, here are some ways: union { Type1 *p1; Type2 *p2; }; or union { Type1 t1; Type2 t2; }; or void *p = Type1 *p1; Type2 *p2 = p; p2->xxx; Feng