From: Eli Friedman Date: Mon, 19 Aug 2013 22:12:56 +0000 (+0000) Subject: Handle init lists and _Atomic fields. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=48a2a3a6ec7a168abdb1e0116bceeac578c132ea;p=clang Handle init lists and _Atomic fields. Fixes PR16931. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188718 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index 2844351e51..009e8c8098 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -837,10 +837,14 @@ void InitListChecker::CheckSubElementType(const InitializedEntity &Entity, // C++ initialization is handled later. } - if (ElemType->isScalarType()) + // FIXME: Need to handle atomic aggregate types with implicit init lists. + if (ElemType->isScalarType() || ElemType->isAtomicType()) return CheckScalarType(Entity, IList, ElemType, Index, StructuredList, StructuredIndex); + assert((ElemType->isRecordType() || ElemType->isVectorType() || + ElemType->isArrayType()) && "Unexpected type"); + if (const ArrayType *arrayType = SemaRef.Context.getAsArrayType(ElemType)) { // arrayType can be incomplete if we're initializing a flexible // array member. There's nothing we can do with the completed diff --git a/test/Sema/atomic-ops.c b/test/Sema/atomic-ops.c index 3a9b972611..c2d38e714b 100644 --- a/test/Sema/atomic-ops.c +++ b/test/Sema/atomic-ops.c @@ -176,3 +176,9 @@ void f(_Atomic(int) *i, _Atomic(int*) *p, _Atomic(float) *d, _Atomic(int*) PR12527_a; void PR12527() { int *b = PR12527_a; } + +void PR16931(int* x) { // expected-note {{passing argument to parameter 'x' here}} + typedef struct { _Atomic(_Bool) flag; } flag; + flag flagvar = { 0 }; + PR16931(&flagvar); // expected-warning {{incompatible pointer types}} +}