[cfe-dev] f6a164819 We don't want to throw lvalue-to-rvalue casts (...) of certain types in C++ (was: Allow implicit copy constructor (...))
Adam Strzelecki
ono at java.pl
Sun May 4 04:53:53 PDT 2014
John, I kindly ask for an explanation of following change introduced by you in f6a164819:
git diff f6a164819^! lib/Sema/SemaExpr.cpp
+ // We don't want to throw lvalue-to-rvalue casts on top of
+ // expressions of certain types in C++.
+ if (getLangOptions().CPlusPlus &&
+ (E->getType() == Context.OverloadTy ||
+ T->isDependentType() ||
+ T->isRecordType()))
+ return;
The problem with this change is that I explicitly request to use C style assignment (ignoring constructors) on POD type variable having `pod_assign` attribute, but condition above prevents proper cast to be emitted.
So far I have simply disabled, since I no longer have direct access to the Entity (VarDecl) to check for PODAssignAttrt, but I am not sure what are consequences of such step.
FYI:
https://github.com/ujhpc/clang/commit/61823c2bc5be78f793bdc8c11365d2bcb50455cc
+++ b/lib/Sema/SemaInit.cpp
@@ -4599,6 +4599,10 @@ void InitializationSequence::InitializeFrom(Sema &S,
// - If the destination type is a (possibly cv-qualified) class type:
if (DestType->isRecordType()) {
+ if (Entity.getDecl()->hasAttr<PODAssignAttr>()) {
+ AddCAssignmentStep(DestType);
+ return;
+ }
Regards,
--
Adam
More information about the cfe-dev
mailing list