blob: e03c2164bae12c72f842e306a0e9a3ef64613711 [file] [log] [blame]
Richard Smith3cdbbdc2013-03-06 01:37:38 +00001// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
Douglas Gregor6cc15182009-09-11 18:44:32 +00002
Andy Gibbs4a529d22012-10-19 12:36:49 +00003void nondecl(int (*f)(int x = 5)) // expected-error {{default arguments can only be specified}}
Douglas Gregor6cc15182009-09-11 18:44:32 +00004{
Andy Gibbs4a529d22012-10-19 12:36:49 +00005 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}}
Douglas Gregor6cc15182009-09-11 18:44:32 +00007}
8
9struct X0 {
10 int (*f)(int = 17); // expected-error{{default arguments can only be specified for parameters in a function declaration}}
Richard Smith3cdbbdc2013-03-06 01:37:38 +000011 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}}
Douglas Gregor6cc15182009-09-11 18:44:32 +000014
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};