forked from OSchip/llvm-project
PR19178 __is_constructible returns true for abstract types.
llvm-svn: 206273
This commit is contained in:
parent
16d671a413
commit
1b4b6bac3b
|
@ -3656,6 +3656,11 @@ static bool evaluateTypeTrait(Sema &S, TypeTrait Kind, SourceLocation KWLoc,
|
|||
if (Args[0]->getType()->isIncompleteType())
|
||||
return false;
|
||||
|
||||
// Make sure the first argument is not an abstract type.
|
||||
CXXRecordDecl *RD = Args[0]->getType()->getAsCXXRecordDecl();
|
||||
if (RD && RD->isAbstract())
|
||||
return false;
|
||||
|
||||
SmallVector<OpaqueValueExpr, 2> OpaqueArgExprs;
|
||||
SmallVector<Expr *, 2> ArgExprs;
|
||||
ArgExprs.reserve(Args.size() - 1);
|
||||
|
|
|
@ -1964,6 +1964,10 @@ void constructible_checks() {
|
|||
|
||||
{ int arr[T(__is_constructible(NonPOD, int))]; }
|
||||
{ int arr[F(__is_nothrow_constructible(NonPOD, int))]; }
|
||||
|
||||
// PR19178
|
||||
{ int arr[F(__is_constructible(Abstract))]; }
|
||||
{ int arr[F(__is_nothrow_constructible(Abstract))]; }
|
||||
}
|
||||
|
||||
// Instantiation of __is_trivially_constructible
|
||||
|
@ -1991,6 +1995,7 @@ void is_trivially_constructible_test() {
|
|||
{ int arr[F((is_trivially_constructible<int, int*>::value))]; }
|
||||
{ int arr[F((is_trivially_constructible<NonTrivialDefault>::value))]; }
|
||||
{ int arr[F((is_trivially_constructible<ThreeArgCtor, int*, char*, int&>::value))]; }
|
||||
{ int arr[F((is_trivially_constructible<Abstract>::value))]; } // PR19178
|
||||
}
|
||||
|
||||
void array_rank() {
|
||||
|
|
Loading…
Reference in New Issue