1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only %s -verify 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambuc enum A { A1, A2, A3 }; test()4*f4a2713aSLionel Sambucvoid test() { 5*f4a2713aSLionel Sambuc A a; 6*f4a2713aSLionel Sambuc a++; // expected-error{{cannot increment expression of enum type 'A'}} 7*f4a2713aSLionel Sambuc a--; // expected-error{{cannot decrement expression of enum type 'A'}} 8*f4a2713aSLionel Sambuc ++a; // expected-error{{cannot increment expression of enum type 'A'}} 9*f4a2713aSLionel Sambuc --a; // expected-error{{cannot decrement expression of enum type 'A'}} 10*f4a2713aSLionel Sambuc } 11*f4a2713aSLionel Sambuc 12*f4a2713aSLionel Sambuc enum B {B1, B2}; operator ++(B & b)13*f4a2713aSLionel Sambucinline B &operator++ (B &b) { b = B((int)b+1); return b; } operator ++(B & b,int)14*f4a2713aSLionel Sambucinline B operator++ (B &b, int) { B ret = b; ++b; return b; } 15*f4a2713aSLionel Sambuc foo(enum B b)16*f4a2713aSLionel Sambucvoid foo(enum B b) { ++b; b++; } 17