diff options
Diffstat (limited to 'test/SemaCXX/cxx0x-delegating-ctors.cpp')
-rw-r--r-- | test/SemaCXX/cxx0x-delegating-ctors.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/test/SemaCXX/cxx0x-delegating-ctors.cpp b/test/SemaCXX/cxx0x-delegating-ctors.cpp index b211cb1..a3e6ff3 100644 --- a/test/SemaCXX/cxx0x-delegating-ctors.cpp +++ b/test/SemaCXX/cxx0x-delegating-ctors.cpp @@ -7,8 +7,9 @@ struct foo { foo(int, int); foo(bool); foo(char); - foo(float*); - foo(float&); + foo(const float*); + foo(const float&); + foo(void*); }; // Good @@ -21,16 +22,27 @@ foo::foo () : foo(-1) { foo::foo (int, int) : foo() { } -foo::foo (bool) : foo(true) { // expected-error{{delegates to itself}} +foo::foo (bool) : foo(true) { // expected-error{{creates a delegation cycle}} } // Good -foo::foo (float* f) : foo(*f) { +foo::foo (const float* f) : foo(*f) { // expected-note{{it delegates to}} } -// FIXME: This should error -foo::foo (float &f) : foo(&f) { +foo::foo (const float &f) : foo(&f) { //expected-error{{creates a delegation cycle}} \ + //expected-note{{which delegates to}} } foo::foo (char) : i(3), foo(3) { // expected-error{{must appear alone}} } + +// 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}} + {} +}; |