1 #define MOZ_NO_ARITHMETIC_EXPR_IN_ARGUMENT __attribute__((annotate("moz_no_arith_expr_in_arg")))
4 explicit X(int) MOZ_NO_ARITHMETIC_EXPR_IN_ARGUMENT
;
5 void baz(int) MOZ_NO_ARITHMETIC_EXPR_IN_ARGUMENT
;
12 void badArithmeticsInArgs() {
18 X
badObj1(a
+ b
); // expected-error{{cannot pass an arithmetic expression of built-in types to 'X'}}
19 X badObj2
= X(a
? 0 : ++a
); // expected-error{{cannot pass an arithmetic expression of built-in types to 'X'}}
20 X
badObj3(~a
); // expected-error{{cannot pass an arithmetic expression of built-in types to 'X'}}
21 badObj1
.baz(a
- 1 - b
); // expected-error{{cannot pass an arithmetic expression of built-in types to 'baz'}}
22 badObj1
.baz(++a
); // expected-error{{cannot pass an arithmetic expression of built-in types to 'baz'}}
23 badObj1
.baz(a
++); // expected-error{{cannot pass an arithmetic expression of built-in types to 'baz'}}
25 badObj1
.baz(a
+ goodObj1
);
26 badObj1
.baz(goodObj1
+ a
);
27 badObj1
.baz(++goodObj1
);
31 badObj1
.baz(1 << (sizeof(int)/2));