r206273 - PR19178 __is_constructible returns true for abstract types.
Nikola Smiljanic
popizdeh at gmail.com
Tue Apr 15 04:30:15 PDT 2014
Author: nikola
Date: Tue Apr 15 06:30:15 2014
New Revision: 206273
URL: http://llvm.org/viewvc/llvm-project?rev=206273&view=rev
Log:
PR19178 __is_constructible returns true for abstract types.
Modified:
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/test/SemaCXX/type-traits.cpp
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=206273&r1=206272&r2=206273&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Tue Apr 15 06:30:15 2014
@@ -3656,6 +3656,11 @@ static bool evaluateTypeTrait(Sema &S, T
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);
Modified: cfe/trunk/test/SemaCXX/type-traits.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/type-traits.cpp?rev=206273&r1=206272&r2=206273&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/type-traits.cpp (original)
+++ cfe/trunk/test/SemaCXX/type-traits.cpp Tue Apr 15 06:30:15 2014
@@ -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() {
More information about the cfe-commits
mailing list