]> granicus.if.org Git - clang/commitdiff
Clean up last commit as per dgregor's comments.
authorDavid Chisnall <csdavec@swan.ac.uk>
Wed, 11 Apr 2012 16:08:14 +0000 (16:08 +0000)
committerDavid Chisnall <csdavec@swan.ac.uk>
Wed, 11 Apr 2012 16:08:14 +0000 (16:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154501 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaOverload.cpp

index 4ba25c4eeba7f6769267918d3a692bca0fb2b024..40fb01ac30d78ba41ee4132f86467dcba48dc1ac 100644 (file)
@@ -1316,13 +1316,6 @@ static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType,
   SCS.setFromType(FromType);
   SCS.CopyConstructor = 0;
 
-  // Allow conversion to _Atomic types.  These are C11 and are provided as an
-  // extension in C++ mode.  
-  if (const AtomicType *ToAtomicType = ToType->getAs<AtomicType>()) {
-    if (ToAtomicType->getValueType() == FromType)
-      return true;
-  }
-
   // There are no standard conversions for class types in C++, so
   // abort early. When overloading in C, however, we do permit
   if (FromType->isRecordType() || ToType->isRecordType()) {
@@ -1527,6 +1520,13 @@ static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType,
                                              SCS, CStyle)) {
     SCS.Second = ICK_TransparentUnionConversion;
     FromType = ToType;
+  }  else if (const AtomicType *ToAtomicType = ToType->getAs<AtomicType>()) {
+    // Allow conversion to _Atomic types.  These are C11 and are provided as an
+    // extension in C++ mode.  
+    if (S.Context.hasSameUnqualifiedType(ToAtomicType->getValueType(),
+                                         FromType))
+    SCS.Second = ICK_Identity;
+    FromType = ToType;
   } else {
     // No second conversion required.
     SCS.Second = ICK_Identity;