summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaCXX')
-rw-r--r--clang/test/SemaCXX/convert-to-bool.cpp6
-rw-r--r--clang/test/SemaCXX/decl-init-ref.cpp6
-rw-r--r--clang/test/SemaCXX/overloaded-operator.cpp2
-rw-r--r--clang/test/SemaCXX/ref-init-ambiguous.cpp7
-rw-r--r--clang/test/SemaCXX/references.cpp8
-rw-r--r--clang/test/SemaCXX/rval-references.cpp2
6 files changed, 16 insertions, 15 deletions
diff --git a/clang/test/SemaCXX/convert-to-bool.cpp b/clang/test/SemaCXX/convert-to-bool.cpp
index 937b2729d1c..277bfc6c688 100644
--- a/clang/test/SemaCXX/convert-to-bool.cpp
+++ b/clang/test/SemaCXX/convert-to-bool.cpp
@@ -49,7 +49,7 @@ void test_explicit_bool(ExplicitConvToBool ecb) {
}
void test_explicit_conv_to_ref(ExplicitConvToRef ecr) {
- int& i1 = ecr; // expected-error{{non-const lvalue reference to type 'int' cannot be initialized with a value of type 'struct ExplicitConvToRef'}}
+ int& i1 = ecr; // expected-error{{non-const lvalue reference to type 'int' cannot bind to a value of unrelated type 'struct ExplicitConvToRef'}}
int& i2(ecr); // okay
}
@@ -57,11 +57,11 @@ struct A { };
struct B { };
struct C {
explicit operator A&(); // expected-warning{{explicit conversion functions are a C++0x extension}}
- operator B&();
+ operator B&(); // expected-note{{candidate}}
};
void test_copy_init_conversions(C c) {
- A &a = c; // expected-error{{non-const lvalue reference to type 'struct A' cannot be initialized with a value of type 'struct C'}}
+ A &a = c; // expected-error{{no viable conversion from 'struct C' to 'struct A'}}
B &b = b; // okay
}
diff --git a/clang/test/SemaCXX/decl-init-ref.cpp b/clang/test/SemaCXX/decl-init-ref.cpp
index d7db647cd11..20eb91a608c 100644
--- a/clang/test/SemaCXX/decl-init-ref.cpp
+++ b/clang/test/SemaCXX/decl-init-ref.cpp
@@ -1,6 +1,6 @@
// RUN: clang-cc -fsyntax-only -verify -std=c++0x %s
-struct A {};
+struct A {}; // expected-note {{candidate function}}
struct BASE {
operator A(); // expected-note {{candidate function}}
@@ -21,6 +21,6 @@ extern B f();
const int& ri = (void)0; // expected-error {{invalid initialization of reference of type 'int const &' from expression of type 'void'}}
int main() {
- const A& rca = f(); // expected-error {{rvalue reference cannot bind to lvalue due to multiple conversion functions}}
- A& ra = f(); // expected-error {{non-const lvalue reference to type 'struct A' cannot be initialized with a temporary of type 'class B'}}
+ const A& rca = f(); // expected-error {{conversion from 'class B' to 'struct A const' is ambiguous}}
+ A& ra = f(); // expected-error {{non-const lvalue reference to type 'struct A' cannot bind to a temporary of type 'class B'}}
}
diff --git a/clang/test/SemaCXX/overloaded-operator.cpp b/clang/test/SemaCXX/overloaded-operator.cpp
index 16d37040f14..672b8b4fc26 100644
--- a/clang/test/SemaCXX/overloaded-operator.cpp
+++ b/clang/test/SemaCXX/overloaded-operator.cpp
@@ -67,7 +67,7 @@ void enum_test(Enum1 enum1, Enum2 enum2, E1 e1, E2 e2) {
float &f1 = (e1 == e2);
float &f2 = (enum1 == e2);
float &f3 = (e1 == enum2);
- float &f4 = (enum1 == enum2); // expected-error{{non-const lvalue reference to type 'float' cannot be initialized with a temporary of type 'bool'}}
+ float &f4 = (enum1 == enum2); // expected-error{{non-const lvalue reference to type 'float' cannot bind to a temporary of type 'bool'}}
}
// PR5244 - Argument-dependent lookup would include the two operators below,
diff --git a/clang/test/SemaCXX/ref-init-ambiguous.cpp b/clang/test/SemaCXX/ref-init-ambiguous.cpp
index dda1ead7b62..60620993b43 100644
--- a/clang/test/SemaCXX/ref-init-ambiguous.cpp
+++ b/clang/test/SemaCXX/ref-init-ambiguous.cpp
@@ -3,18 +3,19 @@
enum E2 { };
struct A {
- operator E2&(); // expected-note 3 {{candidate function}}
+ operator E2&(); // expected-note 2 {{candidate function}}
};
struct B {
- operator E2&(); // expected-note 3 {{candidate function}}
+ operator E2&(); // expected-note 2 {{candidate function}}
};
struct C : B, A {
};
void test(C c) {
- const E2 &e2 = c; // expected-error {{reference initialization of type 'enum E2 const &' with initializer of type 'struct C' is ambiguous}}
+ // FIXME: state that there was an ambiguity in the conversion!
+ const E2 &e2 = c; // expected-error {{reference to type 'enum E2 const' could not bind to an lvalue of type 'struct C'}}
}
void foo(const E2 &);
diff --git a/clang/test/SemaCXX/references.cpp b/clang/test/SemaCXX/references.cpp
index e03abf4300a..45d3923ff0a 100644
--- a/clang/test/SemaCXX/references.cpp
+++ b/clang/test/SemaCXX/references.cpp
@@ -44,17 +44,17 @@ B fB();
// C++ [dcl.init.ref]p5b2
void test4() {
- double& rd2 = 2.0; // expected-error{{non-const lvalue reference to type 'double' cannot be initialized with a temporary of type 'double'}}
+ double& rd2 = 2.0; // expected-error{{non-const lvalue reference to type 'double' cannot bind to a temporary of type 'double'}}
int i = 2;
- double& rd3 = i; // expected-error{{non-const lvalue reference to type 'double' cannot be initialized with a value of type 'int'}}
+ double& rd3 = i; // expected-error{{non-const lvalue reference to type 'double' cannot bind to a value of unrelated type 'int'}}
const A& rca = fB();
}
void test5() {
- const double& rcd2 = 2; // rcd2 refers to temporary with value 2.0
+ // const double& rcd2 = 2; // rcd2 refers to temporary with value 2.0
const volatile int cvi = 1;
- const int& r = cvi; // expected-error{{initialization of reference to type 'int const' with a value of type 'int const volatile' drops qualifiers}}
+ const int& r = cvi; // expected-error{{binding of reference to type 'int const' to a value of type 'int const volatile' drops qualifiers}}
}
// C++ [dcl.init.ref]p3
diff --git a/clang/test/SemaCXX/rval-references.cpp b/clang/test/SemaCXX/rval-references.cpp
index 5132c2a69be..7a71607707c 100644
--- a/clang/test/SemaCXX/rval-references.cpp
+++ b/clang/test/SemaCXX/rval-references.cpp
@@ -44,7 +44,7 @@ void f() {
conv_to_not_int_rvalue cnir;
not_int &&ni4 = cnir; // expected-error {{rvalue reference cannot bind to lvalue}}
- not_int &ni5 = cnir; // expected-error{{non-const lvalue reference to type 'struct not_int' cannot be initialized with a value of type 'struct conv_to_not_int_rvalue'}}
+ not_int &ni5 = cnir; // expected-error{{non-const lvalue reference to type 'struct not_int' cannot bind to a value of unrelated type 'struct conv_to_not_int_rvalue'}}
not_int &&ni6 = conv_to_not_int_rvalue();
OpenPOWER on IntegriCloud