aboutsummaryrefslogtreecommitdiff
path: root/test/Parser/cxx-reference.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2008-10-29 00:13:59 +0000
committerDouglas Gregor <dgregor@apple.com>2008-10-29 00:13:59 +0000
commit27c8dc06f65d7abcf6a7e7f64a7960c9a150ca01 (patch)
tree11c0cafe9243e679b669258afcbf41260033c7be /test/Parser/cxx-reference.cpp
parent1b450b092a053896e96f0355cf7c7cdc9bba9eab (diff)
Implement initialization of a reference (C++ [dcl.init.ref]) as part
of copy initialization. Other pieces of the puzzle: - Try/Perform-ImplicitConversion now handles implicit conversions that don't involve references. - Try/Perform-CopyInitialization uses CheckSingleAssignmentConstraints for C. PerformCopyInitialization is now used for all argument passing and returning values from a function. - Diagnose errors with declaring references and const values without an initializer. (Uses a new Action callback, ActOnUninitializedDecl). We do not yet have implicit conversion sequences for reference binding, which means that we don't have any overloading support for reference parameters yet. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58353 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Parser/cxx-reference.cpp')
-rw-r--r--test/Parser/cxx-reference.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/Parser/cxx-reference.cpp b/test/Parser/cxx-reference.cpp
index 4f3b58c5d5..8d65defe7d 100644
--- a/test/Parser/cxx-reference.cpp
+++ b/test/Parser/cxx-reference.cpp
@@ -3,6 +3,8 @@
extern char *bork;
char *& bar = bork;
+int val;
+
void foo(int &a) {
}
@@ -11,7 +13,7 @@ typedef int & A;
void g(const A aref) {
}
-int & const X; // expected-error {{'const' qualifier may not be applied to a reference}}
-int & volatile Y; // expected-error {{'volatile' qualifier may not be applied to a reference}}
-int & const volatile Z; /* expected-error {{'const' qualifier may not be applied}} \
+int & const X = val; // expected-error {{'const' qualifier may not be applied to a reference}}
+int & volatile Y = val; // expected-error {{'volatile' qualifier may not be applied to a reference}}
+int & const volatile Z = val; /* expected-error {{'const' qualifier may not be applied}} \
expected-error {{'volatile' qualifier may not be applied}} */