• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
3 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
4 
5 extern char *bork;
6 char *& bar = bork;
7 
8 int val;
9 
foo(int & a)10 void foo(int &a) {
11 }
12 
13 typedef int & A;
14 
g(const A aref)15 void g(const A aref) { // expected-warning {{'const' qualifier on reference type 'A' (aka 'int &') has no effect}}
16 }
17 
18 int & const X = val; // expected-error {{'const' qualifier may not be applied to a reference}}
19 int & volatile Y = val; // expected-error {{'volatile' qualifier may not be applied to a reference}}
20 int & const volatile Z = val; /* expected-error {{'const' qualifier may not be applied}} \
21                            expected-error {{'volatile' qualifier may not be applied}} */
22 
23 typedef int && RV;
24 #if __cplusplus <= 199711L
25 // expected-warning@-2 {{rvalue references are a C++11 extension}}
26 #endif
27