[LLVMbugs] [Bug 10306] New: Missing fixit for ternary precedence warning near macros

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jul 7 15:53:42 PDT 2011


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

           Summary: Missing fixit for ternary precedence warning near
                    macros
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: matthewbg at google.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


$ cat testcases/ternary-precedence-fixit.cc
#include <iostream>
#define COUT std::cout
void f() {
  std::cout << "n = " << true ? 1 : 0;
  COUT << "n = " << true ? 1 : 0;
}
$ clang -fsyntax-only -Wparentheses testcases/ternary-precedence-fixit.cc
testcases/ternary-precedence-fixit.cc:4:31: warning: operator '?:' has lower
precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  std::cout << "n = " << true ? 1 : 0;
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
ternary-precedence-fixit.cc:4:31: note: place parentheses around the '<<'
expression to silence this warning
  std::cout << "n = " << true ? 1 : 0;
                              ^
  (                          )
testcases/ternary-precedence-fixit.cc:4:31: note: place parentheses around the
'?:' expression to evaluate it first
  std::cout << "n = " << true ? 1 : 0;
                              ^
                         (           )
testcases/ternary-precedence-fixit.cc:5:26: warning: operator '?:' has lower
precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
  COUT << "n = " << true ? 1 : 0;
  ~~~~~~~~~~~~~~~~~~~~~~ ^
testcases/ternary-precedence-fixit.cc:5:26: note: place parentheses around the
'<<' expression to silence this warning
  COUT << "n = " << true ? 1 : 0;
  ~~~~~~~~~~~~~~~~~~~~~~ ^
testcases/ternary-precedence-fixit.cc:5:26: note: place parentheses around the
'?:' expression to evaluate it first
  COUT << "n = " << true ? 1 : 0;
                         ^
                    (           )

Introducing a macro somehow causes us to lose the fixits for the first note.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list