Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -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}} */ |
Sebastian Redl | 743de1f | 2009-03-23 00:00:23 +0000 | [diff] [blame] | 20 | |
| 21 | typedef int && RV; // expected-error {{rvalue references are only allowed in C++0x}} |