mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-10 16:12:34 +00:00
Don't crash on an invalid trailing return type on a function before a '...'
clang tries to produce a helpful diagnostic for the traiilng '...', but the code that r216778 added for this doesn't expect an invalid trailing return type. Add code to explicitly handle this. Having explicit code for this but not for other things looks a bit strange, but trailing return types are special in that they have a separate existence bit in addition to the type (see r158348). llvm-svn: 224974
This commit is contained in:
parent
81aef1bd52
commit
8d26b72aca
@ -782,11 +782,11 @@ bool Sema::containsUnexpandedParameterPacks(Declarator &D) {
|
||||
Chunk.Fun.NoexceptExpr->containsUnexpandedParameterPack())
|
||||
return true;
|
||||
|
||||
if (Chunk.Fun.hasTrailingReturnType() &&
|
||||
Chunk.Fun.getTrailingReturnType()
|
||||
.get()
|
||||
->containsUnexpandedParameterPack())
|
||||
return true;
|
||||
if (Chunk.Fun.hasTrailingReturnType()) {
|
||||
QualType T = Chunk.Fun.getTrailingReturnType().get();
|
||||
if (!T.isNull() && T->containsUnexpandedParameterPack())
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case DeclaratorChunk::MemberPointer:
|
||||
|
@ -68,6 +68,10 @@ void ci(int ... []); // expected-error{{type 'int []' of function parameter pack
|
||||
void di(int ... x[]); // expected-error{{type 'int []' of function parameter pack does not contain any unexpanded parameter packs}}
|
||||
}
|
||||
|
||||
void f5a(auto fp(int)->unk ...) {} // expected-error{{unknown type name 'unk'}}
|
||||
void f5b(auto fp(int)->auto ...) {} // expected-error{{'auto' not allowed in function return type}}
|
||||
void f5c(auto fp()->...) {} // expected-error{{expected a type}}
|
||||
|
||||
// FIXME: Expand for function and member pointer types.
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user