]> granicus.if.org Git - clang/commitdiff
Handle init lists and _Atomic fields.
authorEli Friedman <eli.friedman@gmail.com>
Mon, 19 Aug 2013 22:12:56 +0000 (22:12 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Mon, 19 Aug 2013 22:12:56 +0000 (22:12 +0000)
Fixes PR16931.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188718 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaInit.cpp
test/Sema/atomic-ops.c

index 2844351e51de4f598deab16fed36d714f7f26f18..009e8c8098b18a8cd82b7c36ab93845e244c7986 100644 (file)
@@ -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
index 3a9b9726112b1155907e7342c91e32bbbb84346e..c2d38e714bf234ca02882ed1a864d80a1c33c15f 100644 (file)
@@ -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}}
+}