blob: d21412cec0fc0a51696119308d57073a87558b17 [file] [log] [blame]
Daniel Dunbar8fbe78f2009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Bill Wendlingcbf47092007-06-03 09:02:28 +00002
Bill Wendling6811c0b2007-05-27 10:16:12 +00003extern char *bork;
4char *& bar = bork;
5
Douglas Gregor8e1cf602008-10-29 00:13:59 +00006int val;
7
Bill Wendling6811c0b2007-05-27 10:16:12 +00008void foo(int &a) {
9}
Bill Wendlingcbf47092007-06-03 09:02:28 +000010
11typedef int & A;
12
13void g(const A aref) {
14}
15
Douglas Gregor8e1cf602008-10-29 00:13:59 +000016int & const X = val; // expected-error {{'const' qualifier may not be applied to a reference}}
17int & volatile Y = val; // expected-error {{'volatile' qualifier may not be applied to a reference}}
18int & const volatile Z = val; /* expected-error {{'const' qualifier may not be applied}} \
Bill Wendlingeb2def62007-06-27 04:30:12 +000019 expected-error {{'volatile' qualifier may not be applied}} */
Sebastian Redl3b27be62009-03-23 00:00:23 +000020
Douglas Gregor205d0442011-10-12 19:26:40 +000021typedef int && RV; // expected-warning {{rvalue references are a C++11 extension}}