1 // RUN: %clang_cc1 -fsyntax-only -DNOEXCEPT= -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -std=c++1z -DNOEXCEPT= -verify %s
3 // RUN: %clang_cc1 -fsyntax-only -std=c++1z -DNOEXCEPT=noexcept -verify %s
5 template<typename T
> T
f0(T
) NOEXCEPT
;
8 // -- an object or reference being initialized
16 int (*f0b
)(int) = &f0
;
17 int (*f0c
)(int) = (f0
);
18 float (*f0d
)(float) = f0
;
19 float (*f0e
)(float) = &f0
;
20 float (*f0f
)(float) = (f0
);
22 int (&f0h
)(int) = (f0
);
23 float (&f0i
)(float) = f0
;
24 float (&f0j
)(float) = (f0
);
28 // -- the left side of an assignment (5.17),
29 void test_assign_f0() {
31 float (*f0b
)(float) = 0;
41 // -- a parameter of a function (5.2.2),
42 void eat_f0(int a(int), float (*b
)(float), int (&c
)(int), float (&d
)(float));
45 eat_f0(f0
, f0
, f0
, f0
);
46 eat_f0(&f0
, &f0
, (f0
), (f0
));
49 // -- a parameter of a user-defined operator (13.5),
51 void operator+(X
, int(int));
52 void operator-(X
, float(*)(float));
53 void operator*(X
, int (&)(int));
54 void operator/(X
, float (&)(float));
56 void test_operator_pass_f0(X x
) {
67 // -- the return value of a function, operator function, or conversion (6.6.3),
68 int (*test_return_f0_a())(int) { return f0
; }
69 int (*test_return_f0_b())(int) { return &f0
; }
70 int (*test_return_f0_c())(int) { return (f0
); }
71 float (*test_return_f0_d())(float) { return f0
; }
72 float (*test_return_f0_e())(float) { return &f0
; }
73 float (*test_return_f0_f())(float) { return (f0
); }
75 // -- an explicit type conversion (5.2.3, 5.2.9, 5.4), or
76 void test_convert_f0() {
77 (void)((int (*)(int))f0
);
78 (void)((int (*)(int))&f0
);
79 (void)((int (*)(int))(f0
));
80 (void)((float (*)(float))f0
);
81 (void)((float (*)(float))&f0
);
82 (void)((float (*)(float))(f0
));
85 // -- a non-type template-parameter(14.3.2).
86 template<int(int)> struct Y0
{ };
87 template<float(float)> struct Y1
{ };
88 template<int (&)(int)> struct Y2
{ };
89 template<float (&)(float)> struct Y3
{ };
98 #if __cplusplus > 201402L
99 namespace MixedNoexcept
{
101 void f() noexcept
; // expected-note {{candidate}}
104 void f(); // expected-note {{candidate}}
106 void (*p
)() noexcept
= &f
; // ok
107 void (*q
)() = &f
; // expected-error {{ambiguous}}
110 // expected-no-diagnostics