xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/warn-pure-virtual-call-from-ctor-dtor.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -fsyntax-only -verify
2*f4a2713aSLionel Sambuc struct A {
AA3*f4a2713aSLionel Sambuc   A() { f(); } // expected-warning {{call to pure virtual member function 'f'; overrides of 'f' in subclasses are not available in the constructor of 'A'}}
~AA4*f4a2713aSLionel Sambuc   ~A() { f(); } // expected-warning {{call to pure virtual member function 'f'; overrides of 'f' in subclasses are not available in the destructor of 'A'}}
5*f4a2713aSLionel Sambuc 
6*f4a2713aSLionel Sambuc   virtual void f() = 0; // expected-note 2 {{'f' declared here}}
7*f4a2713aSLionel Sambuc };
8*f4a2713aSLionel Sambuc 
9*f4a2713aSLionel Sambuc // Don't warn (or note) when calling the function on a pointer. (PR10195)
10*f4a2713aSLionel Sambuc struct B {
11*f4a2713aSLionel Sambuc   A *a;
BB12*f4a2713aSLionel Sambuc   B() { a->f(); };
~BB13*f4a2713aSLionel Sambuc   ~B() { a->f(); };
14*f4a2713aSLionel Sambuc };
15