xref: /llvm-project/clang/test/SemaCXX/increment-decrement.cpp (revision f956a49e6da306c9ec3ac805822035043626481c)
1a49ccfeeSDouglas Gregor // RUN: %clang_cc1 -fsyntax-only -verify %s
2a49ccfeeSDouglas Gregor 
3a49ccfeeSDouglas Gregor volatile int i;
4a49ccfeeSDouglas Gregor 
5a49ccfeeSDouglas Gregor const int &inc = i++;
6a49ccfeeSDouglas Gregor const int &dec = i--;
7a49ccfeeSDouglas Gregor 
8*f956a49eSRichard Trieu const int &incfail = ++i; // expected-error {{drops 'volatile' qualifier}}
9*f956a49eSRichard Trieu const int &decfail = --i; // expected-error {{drops 'volatile' qualifier}}
10a49ccfeeSDouglas Gregor 
11a49ccfeeSDouglas Gregor // PR7794
f0(int e)12a49ccfeeSDouglas Gregor void f0(int e) {
13a49ccfeeSDouglas Gregor   ++(int&)e;
14a49ccfeeSDouglas Gregor }
15