考虑以下程序:
struct A{}; int main() { A a; A b = a; A c = reinterpret_cast<A>(a); }
编译器(g++14)抛出一个关于invalid cast from type 'A' to type 'A'. 为什么强制转换为相同类型无效?
invalid cast from type 'A' to type 'A'
c++ standards reinterpret-cast c++14
c++ ×1
c++14 ×1
reinterpret-cast ×1
standards ×1