contextual conversion fix: C++98 compatibility warning.

llvm-svn: 184167
This commit is contained in:
Larisse Voufo 2013-06-18 03:08:53 +00:00
parent 1fe2a8c87e
commit bf4aa57398
1 changed files with 3 additions and 2 deletions

View File

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