]> granicus.if.org Git - clang/commitdiff
contextual conversion fix: C++98 compatibility warning.
authorLarisse Voufo <lvoufo@google.com>
Tue, 18 Jun 2013 03:08:53 +0000 (03:08 +0000)
committerLarisse Voufo <lvoufo@google.com>
Tue, 18 Jun 2013 03:08:53 +0000 (03:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184167 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExprCXX.cpp

index d723c1fe77dc995826cc3f7b39563be661ae1def..a6b6e36bb7d2e9e7c43f0d54b7446147cf829fa3 100644 (file)
@@ -1194,7 +1194,7 @@ Sema::BuildCXXNew(SourceRange Range, bool UseGlobal,
   //   enumeration type, or a class type for which a single non-explicit
   //   conversion function to integral or unscoped enumeration type exists.
   // C++1y [expr.new]p6: The expression [...] is implicitly converted to
-  //   std::size_t. (FIXME)
+  //   std::size_t.
   if (ArraySize && !ArraySize->isTypeDependent()) {
     ExprResult ConvertedSize;
     if (getLangOpts().CPlusPlus1y) {
@@ -1204,7 +1204,8 @@ Sema::BuildCXXNew(SourceRange Range, bool UseGlobal,
       ConvertedSize = PerformImplicitConversion(ArraySize, Context.getSizeType(),
                                                AA_Converting);
 
-      if (!isSFINAEContext())
+      if (!ConvertedSize.isInvalid() && 
+          ArraySize->getType()->getAs<RecordType>())
         // Diagnose the compatibility of this conversion.
         Diag(StartLoc, diag::warn_cxx98_compat_array_size_conversion)
           << ArraySize->getType() << 0 << "'size_t'";