annotate clang/test/Parser/cxx-reference.cpp @ 223:5f17cb93ff66 llvm-original

LLVM13 (2021/7/18)
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Jul 2021 22:43:00 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
anatofuz
parents:
diff changeset
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
anatofuz
parents:
diff changeset
3 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5 extern char *bork;
anatofuz
parents:
diff changeset
6 char *& bar = bork;
anatofuz
parents:
diff changeset
7
anatofuz
parents:
diff changeset
8 int val;
anatofuz
parents:
diff changeset
9
anatofuz
parents:
diff changeset
10 void foo(int &a) {
anatofuz
parents:
diff changeset
11 }
anatofuz
parents:
diff changeset
12
anatofuz
parents:
diff changeset
13 typedef int & A;
anatofuz
parents:
diff changeset
14
anatofuz
parents:
diff changeset
15 void g(const A aref) { // expected-warning {{'const' qualifier on reference type 'A' (aka 'int &') has no effect}}
anatofuz
parents:
diff changeset
16 }
anatofuz
parents:
diff changeset
17
anatofuz
parents:
diff changeset
18 int & const X = val; // expected-error {{'const' qualifier may not be applied to a reference}}
anatofuz
parents:
diff changeset
19 int & volatile Y = val; // expected-error {{'volatile' qualifier may not be applied to a reference}}
anatofuz
parents:
diff changeset
20 int & const volatile Z = val; /* expected-error {{'const' qualifier may not be applied}} \
anatofuz
parents:
diff changeset
21 expected-error {{'volatile' qualifier may not be applied}} */
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 typedef int && RV;
anatofuz
parents:
diff changeset
24 #if __cplusplus <= 199711L
anatofuz
parents:
diff changeset
25 // expected-warning@-2 {{rvalue references are a C++11 extension}}
anatofuz
parents:
diff changeset
26 #endif