xref: /minix3/external/bsd/llvm/dist/clang/test/Parser/cxx-reference.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 
3 extern char *bork;
4 char *& bar = bork;
5 
6 int val;
7 
foo(int & a)8 void foo(int &a) {
9 }
10 
11 typedef int & A;
12 
g(const A aref)13 void g(const A aref) { // expected-warning {{'const' qualifier on reference type 'A' (aka 'int &') has no effect}}
14 }
15 
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}} \
19                            expected-error {{'volatile' qualifier may not be applied}} */
20 
21 typedef int && RV; // expected-warning {{rvalue references are a C++11 extension}}
22