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