1 // RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -verify -std=c++11 %s
5 virtual void g() = 0; // expected-note{{unimplemented pure virtual method 'g' in 'A'}}
7 void h() = 0; // expected-error {{'h' is not virtual and cannot be declared pure}}
8 void i() = 1; // expected-error {{initializer on function does not look like a pure-specifier}}
9 void j() = 0u; // expected-error {{initializer on function does not look like a pure-specifier}}
18 virtual void A::k() { } // expected-error{{'virtual' can only be specified inside the class definition}}
21 // Needs to recognize that overridden function is virtual.
24 // Needs to recognize that function does not override.
25 void g(int) = 0; // expected-error{{'g' is not virtual and cannot be declared pure}}
28 // Needs to recognize invalid uses of abstract classes.
29 A
fn(A
) // expected-error{{parameter type 'A' is an abstract class}} \
30 // expected-error{{return type 'A' is an abstract class}}
32 A a
; // expected-error{{variable type 'A' is an abstract class}}
33 (void)static_cast<A
>(0); // expected-error{{allocating an object of abstract class type 'A'}}
35 } catch(A
) { // expected-error{{variable type 'A' is an abstract class}}
39 namespace rdar9670557
{
40 typedef int func(int);
51 virtual virtual void func(); // expected-warning {{duplicate 'virtual' declaration specifier}}
55 namespace VirtualFriend
{
56 // DR (filed but no number yet): reject meaningless pure-specifier on a friend declaration.
57 struct A
{ virtual int f(); };
58 struct B
{ friend int A::f() = 0; }; // expected-error {{friend declaration cannot have a pure-specifier}}
61 friend int C::f() = 0; // expected-error {{friend declaration cannot have a pure-specifier}}