| Daniel Dunbar | ffd408a | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
| Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 2 | |
| 3 | extern char *bork; |
| 4 | char *& bar = bork; |
| 5 | |
| Douglas Gregor | 81c2915 | 2008-10-29 00:13:59 +0000 | [diff] [blame] | 6 | int val; |
| 7 | |
| Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +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 | 81c2915 | 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}} \ |
| Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 19 | expected-error {{'volatile' qualifier may not be applied}} */ |
| Sebastian Redl | 4e67adb | 2009-03-23 00:00:23 +0000 | [diff] [blame] | 20 | |
| 21 | typedef int && RV; // expected-error {{rvalue references are only allowed in C++0x}} |