Chris Lattner | 3b427b3 | 2007-10-11 00:18:28 +0000 | [diff] [blame] | 1 | // RUN: clang -fsyntax-only -verify %s |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 2 | |
| 3 | extern char *bork; |
| 4 | char *& bar = bork; |
| 5 | |
Douglas Gregor | 27c8dc0 | 2008-10-29 00:13:59 +0000 | [diff] [blame^] | 6 | int val; |
| 7 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 8 | void foo(int &a) { |
| 9 | } |
| 10 | |
| 11 | typedef int & A; |
| 12 | |
| 13 | void g(const A aref) { |
| 14 | } |
| 15 | |
Douglas Gregor | 27c8dc0 | 2008-10-29 00:13:59 +0000 | [diff] [blame^] | 16 | int & const X = val; // expected-error {{'const' qualifier may not be applied to a reference}} |
| 17 | int & volatile Y = val; // expected-error {{'volatile' qualifier may not be applied to a reference}} |
| 18 | int & const volatile Z = val; /* expected-error {{'const' qualifier may not be applied}} \ |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 19 | expected-error {{'volatile' qualifier may not be applied}} */ |