[cfe-commits] r145203 - in /cfe/trunk: lib/AST/ExprCXX.cpp lib/Sema/SemaExprCXX.cpp test/CodeGenCXX/temporaries.cpp

John McCall rjmccall at apple.com
Sun Nov 27 19:15:11 PST 2011


On Nov 27, 2011, at 2:09 PM, Peter Collingbourne wrote:
> Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=145203&r1=145202&r2=145203&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Sun Nov 27 16:09:28 2011
> @@ -4116,7 +4116,8 @@
>   if (!getLangOptions().CPlusPlus)
>     return Owned(E);
> 
> -  const RecordType *RT = E->getType()->getAs<RecordType>();
> +  QualType ET = Context.getBaseElementType(E->getType());
> +  const RecordType *RT = ET->getAs<RecordType>();
>   if (!RT)
>     return Owned(E);

At the very least, this can be getBaseElementTypeUnsafe(), and
I think I'd be happier if you could find a good way to fast-path the
array check away.  MaybeBindToTemporary happens a whole
lot in C++ code.

John.



More information about the cfe-commits mailing list