[Sema] Remove assert in TreeTransform<Derived>::TransformObjCObjectType.

The assert isn't correct since TypeLoc::ObjCObjectTypeLoc doesn't
indicate whether the type is a dependent type. The function returns
false for a type like "<SomeProtocol>" which is a synonym for
"id<SomeProtocol>".

rdar://problem/23838912

Differential Revision: http://reviews.llvm.org/D17355

llvm-svn: 261829
This commit is contained in:
Akira Hatanaka
2016-02-25 07:08:33 +00:00
parent e5bbca6ae2
commit be8f522ef3
2 changed files with 9 additions and 1 deletions

View File

@@ -5932,7 +5932,6 @@ TreeTransform<Derived>::TransformObjCObjectType(TypeLocBuilder &TLB,
}
ObjCObjectTypeLoc NewT = TLB.push<ObjCObjectTypeLoc>(Result);
assert(TL.hasBaseTypeAsWritten() && "Can't be dependent");
NewT.setHasBaseTypeAsWritten(true);
NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
for (unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)

View File

@@ -0,0 +1,9 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// Make sure we don't crash in TreeTransform<Derived>::TransformObjCObjectType.
@protocol P1
@end
template <class T1><P1> foo1(T1) { // expected-warning {{protocol has no object type specified; defaults to qualified 'id'}}
foo1(0);
}