<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Make init list narrowing diags not DefaultIgnored in clang-cl mode"
href="https://bugs.llvm.org/show_bug.cgi?id=37314">37314</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Make init list narrowing diags not DefaultIgnored in clang-cl mode
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nicolasweber@gmx.de
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>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: <a href="http://llvm-cs.pcc.me.uk/tools/clang/lib/Sema/SemaInit.cpp#8366">http://llvm-cs.pcc.me.uk/tools/clang/lib/Sema/SemaInit.cpp#8366</a>
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.
<a href="http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20120116/051498.html">http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20120116/051498.html</a>
added 2 of these 3 blocks, probably modeled after the 1 that was there. And
that one is from <a href="https://reviews.llvm.org/rL137904">https://reviews.llvm.org/rL137904</a> 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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>