Sema: Don't crash converting to bool from _Atomic

Turning our _Atomic L-value into an R-value removes its _Atomic-ness.
However, we didn't update our 'FromType' which made
ScalarTypeToBooleanCastKind think we were trying to pass it a
non-scalar.

This fixes PR21836.

llvm-svn: 224322
This commit is contained in:
David Majnemer 2014-12-16 06:31:17 +00:00
parent 0f479da711
commit e7029bce82
2 changed files with 5 additions and 1 deletions

View File

@ -2754,10 +2754,10 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
case ICK_Lvalue_To_Rvalue: {
assert(From->getObjectKind() != OK_ObjCProperty);
FromType = FromType.getUnqualifiedType();
ExprResult FromRes = DefaultLvalueConversion(From);
assert(!FromRes.isInvalid() && "Can't perform deduced conversion?!");
From = FromRes.get();
FromType = From->getType();
break;
}

View File

@ -83,3 +83,7 @@ namespace copy_init {
// allows extraneous braces around initializers.
Y y3 = { { X(0) }, { 4 } }; // expected-error 2{{illegal initializer type}}
}
bool PR21836(_Atomic(int) *x) {
return *x;
}