[LLVMbugs] [Bug 22297] New: Spelling suggests something that doesn't make sense, and then shows note for wrong definition

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jan 22 07:33:22 PST 2015


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

            Bug ID: 22297
           Summary: Spelling suggests something that doesn't make sense,
                    and then shows note for wrong definition
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

$ cat test.cc
#include <math.h>

namespace base {
struct TimeTicks {
  static void Now();
};
}

void f() {
  base::TimeTicks::now();
}
$ ~/src/llvm-build/bin/clang -c test.cc -isysroot $(xcrun -show-sdk-path)
test.cc:10:20: error: no member named 'now' in 'base::TimeTicks'; did you mean
'pow'?
  base::TimeTicks::now();
  ~~~~~~~~~~~~~~~~~^~~
                   pow
test.cc:5:15: note: 'pow' declared here
  static void Now();
              ^
1 error generated.



Two problems:

1. pow() doesn't exist in the base::TimeTicks scope, so it shouldn't be
suggested.
2. The note says "'pow' declared here", but it prints at the thing that
should've been suggested.




(If I replace "now" with "pow", I get a different nonsensical suggestion:

test.cc:10:20: error: no member named 'pow' in 'base::TimeTicks'; did you mean
'powf'?
  base::TimeTicks::pow();
  ~~~~~~~~~~~~~~~~~^~~
                   powf
test.cc:5:15: note: 'powf' declared here
  static void Now();
              ^
1 error generated.


If I apply this suggestion, it goes on:


test.cc:10:20: error: no member named 'powf' in 'base::TimeTicks'; did you mean
'cosf'?
  base::TimeTicks::powf();
  ~~~~~~~~~~~~~~~~~^~~~
                   cosf
test.cc:5:15: note: 'cosf' declared here
  static void Now();
              ^
1 error generated.
)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150122/15f6ed73/attachment.html>


More information about the llvm-bugs mailing list