1f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s 2f4a2713aSLionel Sambuc 3f4a2713aSLionel Sambuc struct foo { 4f4a2713aSLionel Sambuc int i; 5f4a2713aSLionel Sambuc foo(); 6f4a2713aSLionel Sambuc foo(int); 7f4a2713aSLionel Sambuc foo(int, int); 8f4a2713aSLionel Sambuc foo(bool); 9f4a2713aSLionel Sambuc foo(char); 10f4a2713aSLionel Sambuc foo(const float*); 11f4a2713aSLionel Sambuc foo(const float&); 12f4a2713aSLionel Sambuc foo(void*); 13f4a2713aSLionel Sambuc }; 14f4a2713aSLionel Sambuc 15f4a2713aSLionel Sambuc // Good foo(int i)16f4a2713aSLionel Sambucfoo::foo (int i) : i(i) { 17f4a2713aSLionel Sambuc } 18f4a2713aSLionel Sambuc // Good foo()19f4a2713aSLionel Sambucfoo::foo () : foo(-1) { 20f4a2713aSLionel Sambuc } 21f4a2713aSLionel Sambuc // Good foo(int,int)22f4a2713aSLionel Sambucfoo::foo (int, int) : foo() { 23f4a2713aSLionel Sambuc } 24f4a2713aSLionel Sambuc foo(bool)25f4a2713aSLionel Sambucfoo::foo (bool) : foo(true) { // expected-error{{creates a delegation cycle}} 26f4a2713aSLionel Sambuc } 27f4a2713aSLionel Sambuc 28f4a2713aSLionel Sambuc // Good foo(const float * f)29f4a2713aSLionel Sambucfoo::foo (const float* f) : foo(*f) { // expected-note{{it delegates to}} 30f4a2713aSLionel Sambuc } 31f4a2713aSLionel Sambuc foo(const float & f)32f4a2713aSLionel Sambucfoo::foo (const float &f) : foo(&f) { //expected-error{{creates a delegation cycle}} \ 33f4a2713aSLionel Sambuc //expected-note{{which delegates to}} 34f4a2713aSLionel Sambuc } 35f4a2713aSLionel Sambuc foo(char)36f4a2713aSLionel Sambucfoo::foo (char) : 37f4a2713aSLionel Sambuc i(3), 38f4a2713aSLionel Sambuc foo(3) { // expected-error{{must appear alone}} 39f4a2713aSLionel Sambuc } 40f4a2713aSLionel Sambuc 41f4a2713aSLionel Sambuc // This should not cause an infinite loop foo(void *)42f4a2713aSLionel Sambucfoo::foo (void*) : foo(4.0f) { 43f4a2713aSLionel Sambuc } 44f4a2713aSLionel Sambuc 45f4a2713aSLionel Sambuc struct deleted_dtor { 46*0a6a1f1dSLionel Sambuc ~deleted_dtor() = delete; // expected-note{{'~deleted_dtor' has been explicitly marked deleted here}} 47f4a2713aSLionel Sambuc deleted_dtor(); deleted_dtordeleted_dtor48f4a2713aSLionel Sambuc deleted_dtor(int) : deleted_dtor() // expected-error{{attempt to use a deleted function}} 49f4a2713aSLionel Sambuc {} 50f4a2713aSLionel Sambuc }; 51