1 // RUN: %clang_cc1 -std=c++11 -verify %s 2 3 // A function that is explicitly defaulted shall 4 // [...] 5 // -- not have default arguments 6 struct DefArg { 7 static DefArg &&make(); 8 DefArg(int n = 5) = default; // expected-error {{an explicitly-defaulted constructor cannot have default arguments}} 9 DefArg(const DefArg &DA = make()) = default; // expected-error {{an explicitly-defaulted constructor cannot have default arguments}} 10 DefArg(const DefArg &DA, int k = 3) = default; // expected-error {{an explicitly-defaulted copy constructor cannot have default arguments}} 11 DefArg(DefArg &&DA = make()) = default; // expected-error {{an explicitly-defaulted constructor cannot have default arguments}} 12 DefArg(DefArg &&DA, int k = 3) = default; // expected-error {{an explicitly-defaulted move constructor cannot have default arguments}} 13 DefArg &operator=(const DefArg&, int k = 4) = default; // expected-error {{parameter of overloaded 'operator=' cannot have a default argument}} 14 DefArg &operator=(DefArg&&, int k = 4) = default; // expected-error {{parameter of overloaded 'operator=' cannot have a default argument}} 15 ~DefArg(int k = 5) = default; // expected-error {{destructor cannot have any parameters}} 16 }; 17