• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2 
3 void nondecl(int (*f)(int x = 5)) // expected-error {{default arguments can only be specified}}
4 {
5   void (*f2)(int = 17)  // expected-error {{default arguments can only be specified}}
6   = (void (*)(int = 42))f; // expected-error {{default arguments can only be specified}}
7 }
8 
9 struct X0 {
10   int (*f)(int = 17); // expected-error{{default arguments can only be specified for parameters in a function declaration}}
11   void (*g())(int = 22); // expected-error{{default arguments can only be specified for parameters in a function declaration}}
12   void (*h(int = 49))(int);
13   auto i(int) -> void (*)(int = 9); // expected-error{{default arguments can only be specified for parameters in a function declaration}}
14 
15   void mem8(int (*fp)(int) = (int (*)(int = 17))0); // expected-error{{default arguments can only be specified for parameters in a function declaration}}
16 };
17 
18 template <typename... Ts>
defaultpack(Ts...=0)19 void defaultpack(Ts... = 0) {} // expected-error{{parameter pack cannot have a default argument}}
20