[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / SemaCXX / cxx0x-delegating-ctors.cpp
blob2e1abf53ae99b63c7078d399fa970d64b457bf15
1 // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
3 struct foo {
4 int i;
5 foo();
6 foo(int);
7 foo(int, int);
8 foo(bool);
9 foo(char);
10 foo(const float*);
11 foo(const float&);
12 foo(void*);
15 // Good
16 foo::foo (int i) : i(i) {
18 // Good
19 foo::foo () : foo(-1) {
21 // Good
22 foo::foo (int, int) : foo() {
25 foo::foo (bool) : foo(true) { // expected-error{{creates a delegation cycle}}
28 // Good
29 foo::foo (const float* f) : foo(*f) { // expected-note{{it delegates to}}
32 foo::foo (const float &f) : foo(&f) { //expected-error{{creates a delegation cycle}} \
33 //expected-note{{which delegates to}}
36 foo::foo (char) :
37 i(3),
38 foo(3) { // expected-error{{must appear alone}}
41 // This should not cause an infinite loop
42 foo::foo (void*) : foo(4.0f) {
45 struct deleted_dtor {
46 ~deleted_dtor() = delete; // expected-note{{'~deleted_dtor' has been explicitly marked deleted here}}
47 deleted_dtor();
48 deleted_dtor(int) : deleted_dtor() // expected-error{{attempt to use a deleted function}}