diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-03-24 20:32:41 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-03-24 20:32:41 +0000 |
commit | bad0e656c3732e3539a9cd6525de721d7e47408b (patch) | |
tree | 3f18b5b2a5688527adfa4e9227922b7144b91151 /lib/Sema/SemaOverload.cpp | |
parent | 337a6271b98c4c183f7eaad1563a75260b4f2871 (diff) |
Type::isObjectType now implements the (more sensible) C++ definition
of "object type" rather than the C definition of "object type". The
difference is that C's "object type" excludes incomplete types such as
struct X;
However, C's definition also makes it far too easy to use isObjectType
as a means to detect incomplete types when in fact we should use other
means (e.g., Sema::RequireCompleteType) that cope with C++ semantics,
including template instantiation.
I've already audited every use of isObjectType and isIncompleteType to
ensure that they are doing the right thing for both C and C++, so this
is patch does not change any functionality.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67648 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaOverload.cpp')
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 9f88a87474..025a245c6c 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -916,8 +916,7 @@ bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType, // An rvalue of type "pointer to cv T," where T is an object type, // can be converted to an rvalue of type "pointer to cv void" (C++ // 4.10p2). - if (FromPointeeType->isIncompleteOrObjectType() && - ToPointeeType->isVoidType()) { + if (FromPointeeType->isObjectType() && ToPointeeType->isVoidType()) { ConvertedType = BuildSimilarlyQualifiedPointerType(FromTypePtr, ToPointeeType, ToType, Context); @@ -2776,7 +2775,7 @@ Sema::AddBuiltinOperatorCandidates(OverloadedOperatorKind Op, for (BuiltinCandidateTypeSet::iterator Ptr = CandidateTypes.pointer_begin(); Ptr != CandidateTypes.pointer_end(); ++Ptr) { // Skip pointer types that aren't pointers to object types. - if (!(*Ptr)->getAsPointerType()->getPointeeType()->isIncompleteOrObjectType()) + if (!(*Ptr)->getAsPointerType()->getPointeeType()->isObjectType()) continue; QualType ParamTypes[2] = { |