<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 - Difference with gcc's -Wmisleading-indentation"
href="https://bugs.llvm.org/show_bug.cgi?id=44324">44324</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Difference with gcc's -Wmisleading-indentation
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>simon.marchi@polymtl.ca
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>clang++ 10 reports a misleading indentation warning with the attached code,
whereas g++ does not.
test.cpp:14:7: warning: misleading indentation; statement is not part of the
previous 'if' [-Wmisleading-indentation]
j = j;
^
test.cpp:11:4: note: previous statement is here
if (k)
^
1 warning generated.
The warning is due to the presence of a spurious space at the beginning of line
12, before the tab. I don't really know if this should warn or not (or if
there's even a right answer to this), but I thought I would report it so you
can judge for yourself.
I've been told [1]that gcc respects tab stops to compute the indentation. My
understanding is that for gcc, "<space><tab>" and "<tab>" will both amount to 8
columns (using the default of -ftabstop=8), so it won't make a difference.
[1] <a href="https://sourceware.org/ml/gdb-patches/2019-12/msg00751.html">https://sourceware.org/ml/gdb-patches/2019-12/msg00751.html</a></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>