forked from OSchip/llvm-project
Allow pseudo-destructor calls on forward-declared Objective-C class pointers.
rdar://18522255 llvm-svn: 255531
This commit is contained in:
parent
c5f510bc23
commit
9d145df4c8
|
@ -5736,9 +5736,14 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S, Expr *Base,
|
|||
//
|
||||
// This also indicates that we could be parsing a pseudo-destructor-name.
|
||||
// Note that Objective-C class and object types can be pseudo-destructor
|
||||
// expressions or normal member (ivar or property) access expressions.
|
||||
// expressions or normal member (ivar or property) access expressions, and
|
||||
// it's legal for the type to be incomplete if this is a pseudo-destructor
|
||||
// call. We'll do more incomplete-type checks later in the lookup process,
|
||||
// so just skip this check for ObjC types.
|
||||
if (BaseType->isObjCObjectOrInterfaceType()) {
|
||||
ObjectType = ParsedType::make(BaseType);
|
||||
MayBePseudoDestructor = true;
|
||||
return Base;
|
||||
} else if (!BaseType->isRecordType()) {
|
||||
ObjectType = ParsedType();
|
||||
MayBePseudoDestructor = true;
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
||||
// expected-no-diagnostics
|
||||
|
||||
__attribute__((objc_root_class))
|
||||
@interface Root
|
||||
@end
|
||||
|
||||
@class Forward;
|
||||
|
||||
template <class T> void destroyPointer(T *t) {
|
||||
t->~T();
|
||||
}
|
||||
|
||||
template <class T> void destroyReference(T &t) {
|
||||
t.~T();
|
||||
}
|
||||
|
||||
template void destroyPointer<Root*>(Root **);
|
||||
template void destroyReference<Root*>(Root *&);
|
||||
|
||||
// rdar://18522255
|
||||
template void destroyPointer<Forward*>(Forward **);
|
||||
template void destroyReference<Forward*>(Forward *&);
|
Loading…
Reference in New Issue