<html>
<head>
<base href="https://llvm.org/bugs/" />
</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 --- - Extraneous array-bounds errors on templated constructor" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24255&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=C8nhM78Mzb0gV2twhzAxUXP7JSgzKEn9mDbmOKZvMy8&s=DBPtvPfEYkLT-BOkXwFg0d7l35EQud1MqZHzpZVxbtQ&e=">24255</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Extraneous array-bounds errors on templated constructor
</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>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</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>dnovillo@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=14644" name="attach_14644" title="Test case">attachment 14644</a> <a href="attachment.cgi?id=14644&action=edit" title="Test case">[details]</a></span>
Test case
Given the attached code, Clang compiles it with no diagnostics (as expected),
but if I introduce an unrelated syntax error, an out-of-bounds warning is
emitted:
$ clang++ -c foo.cc -DEXTRA_ERROR
foo.cc:13:5: error: use of undeclared identifier 'undefined_variable'
undefined_variable++;
^
foo.cc:6:33: warning: array index 2 is past the end of the array (which
contains 2 elements) [-Warray-bounds]
str[2] == '*') {}
^ ~
foo.cc:16:7: note: in instantiation of function template specialization
'Foo::Foo<2>' requested here
Foo f1("*");
^
foo.cc:4:7: note: array 'str' declared here
Foo(const char(&str)[N])
^
1 warning and 1 error generated.
I'm expecting the warning to be emitted even without the syntax error (or not
at all).</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>