2011-05-01 11:04:31 +04:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
|
|
|
|
|
|
|
|
struct foo {
|
|
|
|
int i;
|
|
|
|
foo();
|
|
|
|
foo(int);
|
|
|
|
foo(int, int);
|
|
|
|
foo(bool);
|
|
|
|
foo(char);
|
2011-05-04 03:05:34 +04:00
|
|
|
foo(const float*);
|
|
|
|
foo(const float&);
|
|
|
|
foo(void*);
|
2011-05-01 11:04:31 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
// Good
|
|
|
|
foo::foo (int i) : i(i) {
|
|
|
|
}
|
|
|
|
// Good
|
|
|
|
foo::foo () : foo(-1) {
|
|
|
|
}
|
|
|
|
// Good
|
|
|
|
foo::foo (int, int) : foo() {
|
|
|
|
}
|
|
|
|
|
2011-05-04 09:57:24 +04:00
|
|
|
foo::foo (bool) : foo(true) { // expected-error{{creates a delegation cycle}}
|
2011-05-01 11:04:31 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Good
|
2011-05-04 09:57:24 +04:00
|
|
|
foo::foo (const float* f) : foo(*f) { // expected-note{{it delegates to}}
|
2011-05-01 11:04:31 +04:00
|
|
|
}
|
|
|
|
|
2011-05-04 09:57:24 +04:00
|
|
|
foo::foo (const float &f) : foo(&f) { //expected-error{{creates a delegation cycle}} \
|
|
|
|
//expected-note{{which delegates to}}
|
2011-05-01 11:04:31 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
foo::foo (char) : i(3), foo(3) { // expected-error{{must appear alone}}
|
|
|
|
}
|
2011-05-04 03:05:34 +04: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}}
|
|
|
|
{}
|
|
|
|
};
|