typo-location-bugs.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // RUN: %clang_cc1 -fsyntax-only -verify %s
  2. // RUN: cp %s %t
  3. // RUN: not %clang_cc1 -fsyntax-only -fixit -x c++ %t
  4. // RUN: %clang_cc1 -fsyntax-only -pedantic -Werror -x c++ %t
  5. namespace dcl_fct_default_p10 {
  6. struct A {
  7. virtual void f(int a = 7); // expected-note{{'A::f' declared here}}
  8. };
  9. struct B : public A {
  10. void f(int a);
  11. };
  12. void m() {
  13. B* pb = new B;
  14. A* pa = pb;
  15. pa->f(); // OK, calls pa->B::f(7)
  16. pb->f(); // expected-error{{too few arguments to function call, expected 1, have 0; did you mean 'A::f'?}}
  17. }
  18. }
  19. namespace PR18608 {
  20. struct A {
  21. virtual void f() const;
  22. virtual void f(int x) const; // expected-note{{'A::f' declared here}}
  23. };
  24. struct B : public A {
  25. virtual void f() const;
  26. };
  27. void test(B b) {
  28. b.f(1); // expected-error{{too many arguments to function call, expected 0, have 1; did you mean 'A::f'?}}
  29. }
  30. }
  31. namespace PR20626 {
  32. class A {
  33. public:
  34. void Foo(){}; // expected-note{{'Foo' declared here}}
  35. };
  36. class B {};
  37. class C : public A, public B {
  38. void Run() {
  39. B::Foo(); // expected-error{{no member named 'Foo' in 'PR20626::B'; did you mean simply 'Foo'?}}
  40. }
  41. };
  42. }