cxx-reference.cpp 713 B

123456789101112131415161718192021
  1. // RUN: %clang_cc1 -fsyntax-only -verify %s
  2. extern char *bork;
  3. char *& bar = bork;
  4. int val;
  5. void foo(int &a) {
  6. }
  7. typedef int & A;
  8. void g(const A aref) { // expected-warning {{'const' qualifier on reference type 'A' (aka 'int &') has no effect}}
  9. }
  10. int & const X = val; // expected-error {{'const' qualifier may not be applied to a reference}}
  11. int & volatile Y = val; // expected-error {{'volatile' qualifier may not be applied to a reference}}
  12. int & const volatile Z = val; /* expected-error {{'const' qualifier may not be applied}} \
  13. expected-error {{'volatile' qualifier may not be applied}} */
  14. typedef int && RV; // expected-warning {{rvalue references are a C++11 extension}}