xref: /minix3/external/bsd/llvm/dist/clang/test/Parser/cxx-default-delete.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc int i = delete; // expected-error{{only functions}}
4*f4a2713aSLionel Sambuc int j = default; // expected-error{{special member functions}}
5*f4a2713aSLionel Sambuc 
6*f4a2713aSLionel Sambuc int f() = delete, g; // expected-error{{'= delete' is a function definition}}
7*f4a2713aSLionel Sambuc int o, p() = delete; // expected-error{{'= delete' is a function definition}}
8*f4a2713aSLionel Sambuc 
9*f4a2713aSLionel Sambuc int q() = default, r; // expected-error{{only special member functions}} \
10*f4a2713aSLionel Sambuc                       // expected-error{{'= default' is a function definition}}
11*f4a2713aSLionel Sambuc int s, t() = default; // expected-error{{'= default' is a function definition}}
12*f4a2713aSLionel Sambuc 
13*f4a2713aSLionel Sambuc struct foo {
14*f4a2713aSLionel Sambuc   foo() = default;
15*f4a2713aSLionel Sambuc   ~foo() = delete;
16*f4a2713aSLionel Sambuc   void bar() = delete;
17*f4a2713aSLionel Sambuc };
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc void baz() = delete;
20*f4a2713aSLionel Sambuc 
21*f4a2713aSLionel Sambuc struct quux {
22*f4a2713aSLionel Sambuc   int quux() = default; // expected-error{{constructor cannot have a return type}} expected-error {{member 'quux' has the same name as its class}}
23*f4a2713aSLionel Sambuc };
24