rsmith added inline comments.
================ Comment at: clang/lib/Sema/SemaCast.cpp:1817-1819 + NeedToMaterializeTemporary = + SrcType->isRecordType() || SrcType->isArrayType() || + SrcType->isFunctionPointerType() || SrcType->isMemberPointerType(); ---------------- It looks like GCC allowing a cast from `T*` to `T*&&` is just a bug in their implementation. Consider: ``` using T = int*; T &&r1 = const_cast<T&&>(T{}); // GCC accepts T &&r2 = const_cast<T&&>(T()); // GCC rejects ``` ... and the same behavior seems to show up for all scalar types: they permit `const_cast` from `T{}` but not from `T()` when `T` is `int`, `int*`, .... This doesn't seem like good behavior to follow. I think we should either implement the current direction of 1965 (that is, only allow classes and arrays here) or leave the current behavior (following the standard as-is) alone. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D87565/new/ https://reviews.llvm.org/D87565 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits