On Fri, May 15, 2015 at 3:07 PM, Richard Trieu <[email protected]> wrote:
> Author: rtrieu > Date: Fri May 15 17:07:49 2015 > New Revision: 237482 > > URL: http://llvm.org/viewvc/llvm-project?rev=237482&view=rev > Log: > Reverse the order of types in the reference dropping qualifiers error. > > The error has the form ... 'int' ... 'const int' ... dropped qualifiers. > At > first glance, it appears that the const qualifier is added. Reverse the > types > so that the second type is less qualified than the first. > > Modified: > cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td > cfe/trunk/lib/Sema/SemaInit.cpp > cfe/trunk/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-0x.cpp > cfe/trunk/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp > cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p16.cpp > cfe/trunk/test/Misc/diag-template-diffing.cpp > cfe/trunk/test/SemaCXX/builtins-arm.cpp > cfe/trunk/test/SemaCXX/references.cpp > > Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=237482&r1=237481&r2=237482&view=diff > > ============================================================================== > --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) > +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri May 15 > 17:07:49 2015 > @@ -1490,8 +1490,8 @@ def err_lvalue_reference_bind_to_unrelat > "%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|" > This should be "to reference to type", not "to reference of type", because the following type is not a reference type. > + "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">; > > Modified: cfe/trunk/lib/Sema/SemaInit.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=237482&r1=237481&r2=237482&view=diff > > ============================================================================== > --- cfe/trunk/lib/Sema/SemaInit.cpp (original) > +++ cfe/trunk/lib/Sema/SemaInit.cpp Fri May 15 17:07:49 2015 > @@ -6854,8 +6854,8 @@ bool InitializationSequence::Diagnose(Se > > case FK_ReferenceInitDropsQualifiers: > S.Diag(Kind.getLocation(), diag::err_reference_bind_drops_quals) > - << DestType.getNonReferenceType() > << Args[0]->getType() > + << DestType.getNonReferenceType() > << Args[0]->getSourceRange(); > break; > > > Modified: cfe/trunk/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-0x.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-0x.cpp?rev=237482&r1=237481&r2=237482&view=diff > > ============================================================================== > --- cfe/trunk/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-0x.cpp (original) > +++ cfe/trunk/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-0x.cpp Fri May 15 > 17:07:49 2015 > @@ -123,7 +123,7 @@ namespace std_example_2 { > 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'}} > > Modified: cfe/trunk/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp?rev=237482&r1=237481&r2=237482&view=diff > > ============================================================================== > --- cfe/trunk/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp (original) > +++ cfe/trunk/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp Fri May > 15 17:07:49 2015 > @@ -64,10 +64,10 @@ void bind_lvalue_quals(volatile Base b, > 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; > @@ -118,8 +118,8 @@ void bind_const_lvalue_to_rvalue() { > 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>(); > } > > Modified: cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p16.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p16.cpp?rev=237482&r1=237481&r2=237482&view=diff > > ============================================================================== > --- cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p16.cpp (original) > +++ cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p16.cpp Fri May 15 > 17:07:49 2015 > @@ -24,16 +24,16 @@ void test_capture(X x) { > 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}} > }(); > }(); > }(); > > Modified: cfe/trunk/test/Misc/diag-template-diffing.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/diag-template-diffing.cpp?rev=237482&r1=237481&r2=237482&view=diff > > ============================================================================== > --- cfe/trunk/test/Misc/diag-template-diffing.cpp (original) > +++ cfe/trunk/test/Misc/diag-template-diffing.cpp Fri May 15 17:07:49 2015 > @@ -1258,7 +1258,7 @@ using T = condition<(is_const())>; > 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 { > > Modified: cfe/trunk/test/SemaCXX/builtins-arm.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/builtins-arm.cpp?rev=237482&r1=237481&r2=237482&view=diff > > ============================================================================== > --- cfe/trunk/test/SemaCXX/builtins-arm.cpp (original) > +++ cfe/trunk/test/SemaCXX/builtins-arm.cpp Fri May 15 17:07:49 2015 > @@ -2,5 +2,5 @@ > > // 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}} > } > > Modified: cfe/trunk/test/SemaCXX/references.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/references.cpp?rev=237482&r1=237481&r2=237482&view=diff > > ============================================================================== > --- cfe/trunk/test/SemaCXX/references.cpp (original) > +++ cfe/trunk/test/SemaCXX/references.cpp Fri May 15 17:07:49 2015 > @@ -54,7 +54,7 @@ void test4() { > 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 > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
