<html>
<head>
<base href="http://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 --- - Warning fixit induces lookup failure + error"
href="http://llvm.org/bugs/show_bug.cgi?id=19015">19015</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Warning fixit induces lookup failure + error
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>Axel.Naumann@cern.ch
</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>I'm not claiming this is a beauty, but:
// T.h"
#include <stdlib.h>
#include <cstdlib>
using namespace std;
inline long MyAbs1(long d) { return ::labs(d); }
inline long MyAbs2(long d) { return ::abs(d); }
int fun(long d) {
return MyAbs1(d) + MyAbs2(d);
}
compiled as
clang -fsyntax-only -x c++ T.h
causes
T.h:7:37: warning: absolute value function 'abs' given an argument of type
'long' but has parameter of type
'int' which may cause truncation of value [-Wabsolute-value]
inline long MyAbs2(long d) { return ::abs(d); }
^
T.h:7:37: error: reference to 'labs' is ambiguous
inline long MyAbs2(long d) { return ::abs(d); }
^
/usr/include/stdlib.h:772:17: note: candidate found by name lookup is 'labs'
extern long int labs (long int __x) __THROW __attribute__ ((__const__)) __wur;
^
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/cstdlib:117:11:
note: candidate found by name
lookup is 'std::labs'
using ::labs;
^
1 warning and 1 error generated.
The error is unexpected and seems to be triggered by a failed lookup from fixit
which might ignore the original lookup scope ("::"). I.e. the warning is good,
the error is not. That's with r202469.</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>