[cfe-commits] r155608 - in /cfe/trunk: include/clang/Sema/Initialization.h test/SemaCXX/cxx0x-initializer-references.cpp
Richard Smith
richard at metafoo.co.uk
Wed Apr 25 20:20:22 PDT 2012
This fixes a C++11 crash-on-valid. Requesting a port to the branch!
On Wed, Apr 25, 2012 at 8:16 PM, Richard Smith
<richard-llvm at metafoo.co.uk>wrote:
> Author: rsmith
> Date: Wed Apr 25 22:16:45 2012
> New Revision: 155608
>
> URL: http://llvm.org/viewvc/llvm-project?rev=155608&view=rev
> Log:
> PR12660: Don't crash when initializing a const reference from a braced
> init list
> which creates a temporary by calling a constructor.
>
> Modified:
> cfe/trunk/include/clang/Sema/Initialization.h
> cfe/trunk/test/SemaCXX/cxx0x-initializer-references.cpp
>
> Modified: cfe/trunk/include/clang/Sema/Initialization.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Initialization.h?rev=155608&r1=155607&r2=155608&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/Sema/Initialization.h (original)
> +++ cfe/trunk/include/clang/Sema/Initialization.h Wed Apr 25 22:16:45 2012
> @@ -225,7 +225,9 @@
>
> /// \brief Create the initialization entity for a temporary.
> static InitializedEntity InitializeTemporary(QualType Type) {
> - return InitializedEntity(EK_Temporary, SourceLocation(), Type);
> + InitializedEntity Result(EK_Temporary, SourceLocation(), Type);
> + Result.TypeInfo = 0;
> + return Result;
> }
>
> /// \brief Create the initialization entity for a temporary.
>
> Modified: cfe/trunk/test/SemaCXX/cxx0x-initializer-references.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx0x-initializer-references.cpp?rev=155608&r1=155607&r2=155608&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/SemaCXX/cxx0x-initializer-references.cpp (original)
> +++ cfe/trunk/test/SemaCXX/cxx0x-initializer-references.cpp Wed Apr 25
> 22:16:45 2012
> @@ -85,3 +85,8 @@
> f({1, 2});
> }
> }
> +
> +namespace PR12660 {
> + const int &i { 1 };
> + struct S { S(int); } const &s { 2 };
> +}
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120425/29bda6bc/attachment.html>
More information about the cfe-commits
mailing list