Richard Smith | 3cdbbdc | 2013-03-06 01:37:38 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s |
Douglas Gregor | 6cc1518 | 2009-09-11 18:44:32 +0000 | [diff] [blame] | 2 | |
Andy Gibbs | 4a529d2 | 2012-10-19 12:36:49 +0000 | [diff] [blame] | 3 | void nondecl(int (*f)(int x = 5)) // expected-error {{default arguments can only be specified}} |
Douglas Gregor | 6cc1518 | 2009-09-11 18:44:32 +0000 | [diff] [blame] | 4 | { |
Andy Gibbs | 4a529d2 | 2012-10-19 12:36:49 +0000 | [diff] [blame] | 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}} |
Douglas Gregor | 6cc1518 | 2009-09-11 18:44:32 +0000 | [diff] [blame] | 7 | } |
| 8 | |
| 9 | struct X0 { |
| 10 | int (*f)(int = 17); // expected-error{{default arguments can only be specified for parameters in a function declaration}} |
Richard Smith | 3cdbbdc | 2013-03-06 01:37:38 +0000 | [diff] [blame] | 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}} |
Douglas Gregor | 6cc1518 | 2009-09-11 18:44:32 +0000 | [diff] [blame] | 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 | }; |