From b92a1565c37194cee915249eb1330c05cbef6c7e Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 3 Feb 2010 00:27:59 +0000 Subject: Implement the lvalue-to-rvalue conversion where needed. The lvalue-to-rvalue conversion adjusts lvalues of qualified, non-class type to rvalue expressions of the unqualified variant of that type. For example, given: const int i; (void)(i + 17); the lvalue-to-rvalue conversion for the subexpression "i" will turn it from an lvalue expression (a DeclRefExpr) with type 'const int' into an rvalue expression with type 'int'. Both C and C++ mandate this conversion, and somehow we've slid through without implementing it. We now have both DefaultFunctionArrayConversion and DefaultFunctionArrayLvalueConversion, and which gets used depends on whether we do the lvalue-to-rvalue conversion or not. Generally, we do the lvalue-to-rvalue conversion, but there are a few notable exceptions: - the left-hand side of a '.' operator - the left-hand side of an assignment - a C++ throw expression - a subscript expression that's subscripting a vector Making this change exposed two issues with blocks: - we were deducing const-qualified return types of non-class type from a block return, which doesn't fit well - we weren't always setting the known return type of a block when it was provided with the ^return-type syntax Fixes the current Clang-on-Clang compile failure and PR6076. llvm-svn: 95167 --- clang/test/SemaCXX/reinterpret-cast.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/test/SemaCXX/reinterpret-cast.cpp') diff --git a/clang/test/SemaCXX/reinterpret-cast.cpp b/clang/test/SemaCXX/reinterpret-cast.cpp index da675609d12..f7ab80e67fd 100644 --- a/clang/test/SemaCXX/reinterpret-cast.cpp +++ b/clang/test/SemaCXX/reinterpret-cast.cpp @@ -47,7 +47,7 @@ void constness() // Invalid: T1 const* -> T2* (void)reinterpret_cast(icp); // expected-error {{reinterpret_cast from 'int const *' to 'int *' casts away constness}} // Invalid: T1*** -> T2 const* const** - int const *const **icpcpp = reinterpret_cast(ipppc); // expected-error {{reinterpret_cast from 'int ***const' to 'int const *const **' casts away constness}} + int const *const **icpcpp = reinterpret_cast(ipppc); // expected-error {{reinterpret_cast from 'int ***' to 'int const *const **' casts away constness}} // Valid: T1* -> T2* int *ip = reinterpret_cast(icpcpp); // Valid: T* -> T const* -- cgit v1.2.3