1 // RUN: clang-cc -fsyntax-only -verify %s
24 yes
& islong(unsigned long); // FIXME: shouldn't be needed
27 void f(Short s
, Long l
, Enum1 e1
, Enum2 e2
) {
32 // C++ [over.built]p10:
36 // C++ [over.built]p12
37 (void)static_cast<yes
&>(islong(s
+ l
));
38 (void)static_cast<no
&>(islong(s
+ s
));
40 // C++ [over.built]p17
41 (void)static_cast<yes
&>(islong(s
% l
));
42 (void)static_cast<yes
&>(islong(l
<< s
));
43 (void)static_cast<no
&>(islong(s
<< l
));
44 (void)static_cast<yes
&>(islong(e1
% l
));
45 // FIXME: should pass (void)static_cast<no&>(islong(e1 % e2));
53 operator volatile long&();
56 void g(ShortRef sr
, LongRef lr
) {
63 // C++ [over.built]p18
64 short& sr1
= (sr
*= lr
);
65 volatile long& lr1
= (lr
*= sr
);
67 // C++ [over.built]p22
68 short& sr2
= (sr
%= lr
);
69 volatile long& lr2
= (lr
<<= sr
);
71 bool b1
= (sr
&& lr
) || (sr
|| lr
);
74 struct VolatileIntPtr
{
75 operator int volatile *();
79 operator int const *();
82 struct VolatileIntPtrRef
{
83 operator int volatile *&();
86 struct ConstIntPtrRef
{
87 operator int const *&();
90 void test_with_ptrs(VolatileIntPtr vip
, ConstIntPtr cip
, ShortRef sr
,
91 VolatileIntPtrRef vipr
, ConstIntPtrRef cipr
) {
92 const int& cir1
= cip
[sr
];
93 const int& cir2
= sr
[cip
];
94 volatile int& vir1
= vip
[sr
];
95 volatile int& vir2
= sr
[vip
];
96 bool b1
= (vip
== cip
);
99 // C++ [over.built]p5:
100 int volatile *vip1
= vipr
++;
101 int const *cip1
= cipr
++;
102 int volatile *&vipr1
= ++vipr
;
103 int const *&cipr1
= --cipr
;
105 // C++ [over.built]p6:
106 int volatile &ivr
= *vip
;
108 // C++ [over.built]p8:
109 int volatile *vip2
= +vip
;
113 // C++ [over.built]p13:
114 int volatile &ivr2
= vip
[17];
115 int const &icr2
= 17[cip
];
118 // C++ [over.match.open]p4
120 void test_assign_restrictions(ShortRef
& sr
) {
121 sr
= (short)0; // expected-error{{no viable overloaded '='}}