blob: 58bd7ab607276edd646b7104bc5b1c7a654ba322 [file] [log] [blame]
Daniel Dunbar8fbe78f2009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Charles Li85dec552015-12-10 01:07:17 +00002// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
3// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
Bill Wendlingcbf47092007-06-03 09:02:28 +00004
Bill Wendling6811c0b2007-05-27 10:16:12 +00005extern char *bork;
6char *& bar = bork;
7
Douglas Gregor8e1cf602008-10-29 00:13:59 +00008int val;
9
Bill Wendling6811c0b2007-05-27 10:16:12 +000010void foo(int &a) {
11}
Bill Wendlingcbf47092007-06-03 09:02:28 +000012
13typedef int & A;
14
Richard Smith40259442014-02-19 00:13:27 +000015void g(const A aref) { // expected-warning {{'const' qualifier on reference type 'A' (aka 'int &') has no effect}}
Bill Wendlingcbf47092007-06-03 09:02:28 +000016}
17
Douglas Gregor8e1cf602008-10-29 00:13:59 +000018int & const X = val; // expected-error {{'const' qualifier may not be applied to a reference}}
19int & volatile Y = val; // expected-error {{'volatile' qualifier may not be applied to a reference}}
20int & const volatile Z = val; /* expected-error {{'const' qualifier may not be applied}} \
Bill Wendlingeb2def62007-06-27 04:30:12 +000021 expected-error {{'volatile' qualifier may not be applied}} */
Sebastian Redl3b27be62009-03-23 00:00:23 +000022
Charles Li85dec552015-12-10 01:07:17 +000023typedef int && RV;
24#if __cplusplus <= 199711L
25// expected-warning@-2 {{rvalue references are a C++11 extension}}
26#endif