Bug ID: 41100
           Summary: "in call to f(x)" note should pretty-print original
                    value of argument 'x', not mutated value
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs

When Clang prints diagnostic notes of the form " call to f(arg1,
arg2)...", it seems to lose track of the arguments' ORIGINAL values. Clang ends
up pretty-printing the CHANGED values of those arguments. This can be very
confusing, especially when there's recursion involved, because the text of the
diagnostic will appear to be talking about a call that never appears in the
source code (or worse, a call that coincidentally DOES appear in the source
code, but isn't the culprit). Here's a reduced test case:

constexpr int f(int i) {
    i = -i;
    return 1 << i;

The problematic part of the following error message is where it mentions "call
to 'f(-1)'". It should mention "call to 'f(1)'" instead.

<source>:7:15: error: static_assert expression is not an integral constant
<source>:4:14: note: negative shift count -1
    return 1 << i;
<source>:7:15: note: in call to 'f(-1)'
1 error generated.

You are receiving this mail because:
You are on the CC list for the bug.
llvm-bugs mailing list

Reply via email to