Sebastian Redl | 0f8b23f | 2009-03-16 23:22:08 +0000 | [diff] [blame] | 1 | // RUN: clang -fsyntax-only -verify %s |
Bill Wendling | cbf4709 | 2007-06-03 09:02:28 +0000 | [diff] [blame] | 2 | |
Bill Wendling | 6811c0b | 2007-05-27 10:16:12 +0000 | [diff] [blame] | 3 | extern char *bork; |
| 4 | char *& bar = bork; |
| 5 | |
Douglas Gregor | 8e1cf60 | 2008-10-29 00:13:59 +0000 | [diff] [blame] | 6 | int val; |
| 7 | |
Bill Wendling | 6811c0b | 2007-05-27 10:16:12 +0000 | [diff] [blame] | 8 | void foo(int &a) { |
| 9 | } |
Bill Wendling | cbf4709 | 2007-06-03 09:02:28 +0000 | [diff] [blame] | 10 | |
| 11 | typedef int & A; |
| 12 | |
| 13 | void g(const A aref) { |
| 14 | } |
| 15 | |
Douglas Gregor | 8e1cf60 | 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}} \ |
Bill Wendling | eb2def6 | 2007-06-27 04:30:12 +0000 | [diff] [blame] | 19 | expected-error {{'volatile' qualifier may not be applied}} */ |
Sebastian Redl | 3b27be6 | 2009-03-23 00:00:23 +0000 | [diff] [blame^] | 20 | |
| 21 | typedef int && RV; // expected-error {{rvalue references are only allowed in C++0x}} |