2011-10-14 06:29:44 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
|
2011-05-01 15:04:31 +08:00
|
|
|
|
|
|
|
struct foo {
|
|
|
|
int i;
|
|
|
|
foo();
|
|
|
|
foo(int);
|
|
|
|
foo(int, int);
|
|
|
|
foo(bool);
|
|
|
|
foo(char);
|
2011-05-04 07:05:34 +08:00
|
|
|
foo(const float*);
|
|
|
|
foo(const float&);
|
|
|
|
foo(void*);
|
2011-05-01 15:04:31 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
// Good
|
|
|
|
foo::foo (int i) : i(i) {
|
|
|
|
}
|
|
|
|
// Good
|
|
|
|
foo::foo () : foo(-1) {
|
|
|
|
}
|
|
|
|
// Good
|
|
|
|
foo::foo (int, int) : foo() {
|
|
|
|
}
|
|
|
|
|
2011-05-04 13:57:24 +08:00
|
|
|
foo::foo (bool) : foo(true) { // expected-error{{creates a delegation cycle}}
|
2011-05-01 15:04:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Good
|
2011-05-04 13:57:24 +08:00
|
|
|
foo::foo (const float* f) : foo(*f) { // expected-note{{it delegates to}}
|
2011-05-01 15:04:31 +08:00
|
|
|
}
|
|
|
|
|
2011-05-04 13:57:24 +08:00
|
|
|
foo::foo (const float &f) : foo(&f) { //expected-error{{creates a delegation cycle}} \
|
|
|
|
//expected-note{{which delegates to}}
|
2011-05-01 15:04:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
foo::foo (char) : i(3), foo(3) { // expected-error{{must appear alone}}
|
|
|
|
}
|
2011-05-04 07:05:34 +08:00
|
|
|
|
|
|
|
// This should not cause an infinite loop
|
|
|
|
foo::foo (void*) : foo(4.0f) {
|
|
|
|
}
|
|
|
|
|
|
|
|
struct deleted_dtor {
|
|
|
|
~deleted_dtor() = delete; // expected-note{{function has been explicitly marked deleted here}}
|
|
|
|
deleted_dtor();
|
|
|
|
deleted_dtor(int) : deleted_dtor() // expected-error{{attempt to use a deleted function}}
|
|
|
|
{}
|
|
|
|
};
|