[llvm-bugs] [Bug 37314] New: Make init list narrowing diags not DefaultIgnored in clang-cl mode

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 2 08:41:06 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=37314

            Bug ID: 37314
           Summary: Make init list narrowing diags not DefaultIgnored in
                    clang-cl mode
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

warn_init_list_type_narrowing, warn_init_list_variable_narrowing,
warn_init_list_constant_narrowing are currently DefaultIgnore.

The only 3 places that reference these DefaultIgnore versions are here and the
next few lines: http://llvm-cs.pcc.me.uk/tools/clang/lib/Sema/SemaInit.cpp#8366
All 3 cases look like so:

  case NK_Type_Narrowing:
    // This was a floating-to-integer conversion, which is always considered a
    // narrowing conversion even if the value is a constant and can be
    // represented exactly as an integer.
    S.Diag(PostInit->getLocStart(),
           (S.getLangOpts().MicrosoftExt || !S.getLangOpts().CPlusPlus11)
               ? diag::warn_init_list_type_narrowing
               : diag::ext_init_list_type_narrowing)
      << PostInit->getSourceRange()
      << PreNarrowingType.getLocalUnqualifiedType()
      << EntityType.getLocalUnqualifiedType();
    break;

So they're only DefaultIgnored in clang-cl mode, not in clang mode.

http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20120116/051498.html
added 2 of these 3 blocks, probably modeled after the 1 that was there. And
that one is from https://reviews.llvm.org/rL137904 from 6 years ago by fpichet,
before we had come up with a principled way of handling cl.exe compatibility.

We should probably try to emit these in MS mode as well (in headers, they'll be
ignored and things should hopefully work), or if that causes issues, at least
do so if the -fmsc-version is new enough assuming newer cl's diag on this.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180502/0e6e5788/attachment.html>


More information about the llvm-bugs mailing list