1 /* { dg-do compile } */
2 /* { dg-options "-fstrub=relaxed -Wpedantic" } */
3 /* { dg-require-effective-target strub } */
5 /* C++ does not warn about the partial incompatibilities.
7 The d_p () calls are actually rejected, even in C++, but they are XFAILed
8 here because we don't get far enough in the compilation as to observe them,
9 because the incompatibilities are errors without -fpermissive.
10 strub-ptrfn3.c uses -fpermissive to check those.
13 extern int __attribute__ ((strub ("callable"))) bac (void);
14 extern int __attribute__ ((strub ("disabled"))) bad (void);
15 extern int __attribute__ ((strub ("internal"))) bar (void);
16 extern int __attribute__ ((strub ("at-calls"))) bal (void);
18 void __attribute__ ((strub
))
21 int __attribute__ ((strub ("disabled"))) (*d_p
) (void) = bad
;
22 int __attribute__ ((strub ("callable"))) (*c_p
) (void) = bac
;
23 int __attribute__ ((strub ("at-calls"))) (*a_p
) (void) = bal
;
25 d_p
= bac
; /* { dg-warning "not quite compatible" "" { xfail c++ } } */
26 c_p
= bad
; /* { dg-warning "not quite compatible" "" { xfail c++ } } */
27 c_p
= bar
; /* { dg-warning "not quite compatible" "" { xfail c++ } } */
28 c_p
= bal
; /* { dg-message "incompatible|invalid conversion" } */
29 a_p
= bac
; /* { dg-message "incompatible|invalid conversion" } */
31 d_p (); /* { dg-error "indirect non-.strub. call in .strub. context" "" { xfail *-*-* } } */
36 void __attribute__ ((strub
))
39 typedef int __attribute__ ((strub ("disabled"))) d_fn_t (void);
40 typedef int __attribute__ ((strub ("callable"))) c_fn_t (void);
41 typedef int __attribute__ ((strub ("at-calls"))) a_fn_t (void);
47 d_p
= bac
; /* { dg-warning "not quite compatible" "" { xfail c++ } } */
48 c_p
= bad
; /* { dg-warning "not quite compatible" "" { xfail c++ } } */
49 c_p
= bar
; /* { dg-warning "not quite compatible" "" { xfail c++ } } */
50 c_p
= bal
; /* { dg-message "incompatible|invalid conversion" } */
51 a_p
= bac
; /* { dg-message "incompatible|invalid conversion" } */
53 d_p (); /* { dg-error "indirect non-.strub. call in .strub. context" "" { xfail *-*-* } } */