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