http://llvm.org/bugs/show_bug.cgi?id=19015

            Bug ID: 19015
           Summary: Warning fixit induces lookup failure + error
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to