Richard Smith | 762bb9d | 2011-10-13 22:29:44 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s |
Sean Hunt | 7880bc3 | 2011-05-13 01:01:05 +0000 | [diff] [blame] | 2 | |
| 3 | int i = delete; // expected-error{{only functions}} |
| 4 | int j = default; // expected-error{{special member functions}} |
| 5 | |
Sebastian Redl | ecfcd56 | 2012-02-11 23:51:21 +0000 | [diff] [blame] | 6 | int f() = delete, g; // expected-error{{'= delete' is a function definition}} |
| 7 | int o, p() = delete; // expected-error{{'= delete' is a function definition}} |
| 8 | |
| 9 | int q() = default, r; // expected-error{{only special member functions}} \ |
| 10 | // expected-error{{'= default' is a function definition}} |
| 11 | int s, t() = default; // expected-error{{'= default' is a function definition}} |
Sean Hunt | 7880bc3 | 2011-05-13 01:01:05 +0000 | [diff] [blame] | 12 | |
| 13 | struct foo { |
| 14 | foo() = default; |
| 15 | ~foo() = delete; |
| 16 | void bar() = delete; |
| 17 | }; |
| 18 | |
| 19 | void baz() = delete; |
Richard Smith | c430ef4 | 2011-11-10 09:08:44 +0000 | [diff] [blame] | 20 | |
| 21 | struct quux { |
| 22 | int quux() = default; // expected-error{{constructor cannot have a return type}} expected-error {{member 'quux' has the same name as its class}} |
| 23 | }; |