forked from OSchip/llvm-project
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:
parent
0f479da711
commit
e7029bce82
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue