blob: 8766d861732e93ec1200cf0f59fc68fe129cf9d3 [file] [log] [blame]
Richard Smith9ca5c422011-10-13 22:29:44 +00001// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
Alexis Hunt94f9cbf2011-05-13 01:01:05 +00002
3int i = delete; // expected-error{{only functions}}
4int j = default; // expected-error{{special member functions}}
5
Sebastian Redl46afb552012-02-11 23:51:21 +00006int f() = delete, g; // expected-error{{'= delete' is a function definition}}
7int o, p() = delete; // expected-error{{'= delete' is a function definition}}
8
9int q() = default, r; // expected-error{{only special member functions}} \
10 // expected-error{{'= default' is a function definition}}
11int s, t() = default; // expected-error{{'= default' is a function definition}}
Alexis Hunt94f9cbf2011-05-13 01:01:05 +000012
13struct foo {
14 foo() = default;
15 ~foo() = delete;
16 void bar() = delete;
17};
18
19void baz() = delete;
Richard Smith1c704732011-11-10 09:08:44 +000020
21struct quux {
Richard Smitha60a6db2015-07-06 01:04:39 +000022 int quux() = default; // expected-error{{constructor cannot have a return type}}
Richard Smith1c704732011-11-10 09:08:44 +000023};