"%diff{to type $ cannot bind to a value of unrelated type $|"
"cannot bind to a value of unrelated type}1,2">;
def err_reference_bind_drops_quals : Error<
- "binding of reference %diff{to type $ to a value of type $ drops qualifiers|"
- "drops qualifiers}0,1">;
+ "binding value %diff{of type $ to reference of type $ drops qualifiers|"
+ "to reference drops qualifiers}0,1">;
def err_reference_bind_failed : Error<
"reference %diff{to type $ could not bind to an %select{rvalue|lvalue}1 of "
"type $|could not bind to %select{rvalue|lvalue}1 of incompatible type}0,2">;
case FK_ReferenceInitDropsQualifiers:
S.Diag(Kind.getLocation(), diag::err_reference_bind_drops_quals)
- << DestType.getNonReferenceType()
<< Args[0]->getType()
+ << DestType.getNonReferenceType()
<< Args[0]->getSourceRange();
break;
const double& rcd2 = 2;
double&& rrd = 2;
const volatile int cvi = 1;
- const int& r2 = cvi; // expected-error{{binding of reference to type 'const int' to a value of type 'const volatile int' drops qualifiers}}
+ const int& r2 = cvi; // expected-error{{binding value of type 'const volatile int' to reference of type 'const int' drops qualifiers}}
double d;
double&& rrd2 = d; // expected-error{{rvalue reference to type 'double' cannot bind to lvalue of type 'double'}}
volatile const int ivc) {
volatile Base &bvr1 = b;
volatile Base &bvr2 = d;
- volatile Base &bvr3 = bvc; // expected-error{{binding of reference to type 'volatile Base' to a value of type 'const volatile Base' drops qualifiers}}
- volatile Base &bvr4 = dvc; // expected-error{{binding of reference to type 'volatile Base' to a value of type 'const volatile Derived' drops qualifiers}}
+ volatile Base &bvr3 = bvc; // expected-error{{binding value of type 'const volatile Base' to reference of type 'volatile Base' drops qualifiers}}
+ volatile Base &bvr4 = dvc; // expected-error{{binding value of type 'const volatile Derived' to reference of type 'volatile Base' drops qualifiers}}
- volatile int &ir = ivc; // expected-error{{binding of reference to type 'volatile int' to a value of type 'const volatile int' drops qualifiers}}
+ volatile int &ir = ivc; // expected-error{{binding value of type 'const volatile int' to reference of type 'volatile int' drops qualifiers}}
const volatile Base &bcvr1 = b;
const volatile Base &bcvr2 = d;
const Base &br3 = create<const Base>();
const Base &br4 = create<const Derived>();
- const Base &br5 = create<const volatile Base>(); // expected-error{{binding of reference to type 'const Base' to a value of type 'const volatile Base' drops qualifiers}}
- const Base &br6 = create<const volatile Derived>(); // expected-error{{binding of reference to type 'const Base' to a value of type 'const volatile Derived' drops qualifiers}}
+ const Base &br5 = create<const volatile Base>(); // expected-error{{binding value of type 'const volatile Base' to reference of type 'const Base' drops qualifiers}}
+ const Base &br6 = create<const volatile Derived>(); // expected-error{{binding value of type 'const volatile Derived' to reference of type 'const Base' drops qualifiers}}
const int &ir = create<int>();
}
int a;
[=]{
[&] {
- int &x = a; // expected-error{{binding of reference to type 'int' to a value of type 'const int' drops qualifiers}}
- int &x2 = a; // expected-error{{binding of reference to type 'int' to a value of type 'const int' drops qualifiers}}
+ int &x = a; // expected-error{{binding value of type 'const int' to reference of type 'int' drops qualifiers}}
+ int &x2 = a; // expected-error{{binding value of type 'const int' to reference of type 'int' drops qualifiers}}
}();
}();
[=]{
[&a] {
[&] {
- int &x = a; // expected-error{{binding of reference to type 'int' to a value of type 'const int' drops qualifiers}}
- int &x2 = a; // expected-error{{binding of reference to type 'int' to a value of type 'const int' drops qualifiers}}
+ int &x = a; // expected-error{{binding value of type 'const int' to reference of type 'int' drops qualifiers}}
+ int &x2 = a; // expected-error{{binding value of type 'const int' to reference of type 'int' drops qualifiers}}
}();
}();
}();
void foo(const T &t) {
T &t2 = t;
}
-// CHECK-ELIDE-NOTREE: binding of reference to type 'condition<[...]>' to a value of type 'const condition<[...]>' drops qualifiers
+// CHECK-ELIDE-NOTREE: binding value of type 'const condition<[...]>' to reference of type 'condition<[...]>' drops qualifiers
}
namespace BoolArgumentBitExtended {
// va_list on ARM AAPCS is struct { void* __ap }.
int test1(const __builtin_va_list &ap) {
- return __builtin_va_arg(ap, int); // expected-error {{binding of reference to type '__builtin_va_list' to a value of type 'const __builtin_va_list' drops qualifiers}}
+ return __builtin_va_arg(ap, int); // expected-error {{binding value of type 'const __builtin_va_list' to reference of type '__builtin_va_list' drops qualifiers}}
}
void test5() {
// const double& rcd2 = 2; // rcd2 refers to temporary with value 2.0
const volatile int cvi = 1;
- const int& r = cvi; // expected-error{{binding of reference to type 'const int' to a value of type 'const volatile int' drops qualifiers}}
+ const int& r = cvi; // expected-error{{binding value of type 'const volatile int' to reference of type 'const int' drops qualifiers}}
}
// C++ [dcl.init.ref]p3