[prev in list] [next in list] [prev in thread] [next in thread]
List: cfe-commits
Subject: Re: [PATCH] D7606: Fix adress cast for C++ in SEMA
From: Richard Smith <richard () metafoo ! co ! uk>
Date: 2015-07-21 21:11:12
Message-ID: 591d53ef2966b64e668fc9fec536ed8d () localhost ! localdomain
[Download RAW message or body]
rsmith added inline comments.
================
Comment at: lib/Sema/Sema.cpp:366
@@ +365,3 @@
+ // In the event an address space cast is requested, the kind passed from the
+ // caller should no be CK_NoOp.
+ assert((Kind != CK_NoOp ||
----------------
Typo "no" -> "not"
================
Comment at: lib/Sema/SemaCast.cpp:2106-2113
@@ -2105,1 +2105,10 @@
+ // If we are casting pointers, we need to check whether this refers to an
+ // address cast.
+ if (DestType->isPointerType() && SrcExpr.get()->getType()->isPointerType() &&
+ DestType->getPointeeType().getAddressSpace() !=
+ SrcExpr.get()->getType().getAddressSpace()) {
+ Kind = CK_AddressSpaceConversion;
+ return;
+ }
+
----------------
Looks like this would allow casting between any pointer type and any other pointer \
type with a different address space, independent of the pointee type. That's not \
right; we should still diagnose casts between pointer-to-object and \
pointer-to-function types and the like. Also, `reinterpret_cast`s will still fail \
with this check. This check should go at the end of `TryReinterpretCast` rather than \
here.
http://reviews.llvm.org/D7606
_______________________________________________
cfe-commits mailing list
cfe-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic