r216457 - Some versions of MSVC do not support initializer list construction of vectors, so this fixes a broken build from r216385.

David Blaikie dblaikie at gmail.com
Tue Aug 26 10:11:08 PDT 2014


On Tue, Aug 26, 2014 at 7:17 AM, Aaron Ballman <aaron at aaronballman.com> wrote:
> Author: aaronballman
> Date: Tue Aug 26 09:17:25 2014
> New Revision: 216457
>
> URL: http://llvm.org/viewvc/llvm-project?rev=216457&view=rev
> Log:
> Some versions of MSVC do not support initializer list construction of vectors, so this fixes a broken build from r216385.
>
> Modified:
>     cfe/trunk/unittests/AST/ASTVectorTest.cpp
>
> Modified: cfe/trunk/unittests/AST/ASTVectorTest.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/ASTVectorTest.cpp?rev=216457&r1=216456&r2=216457&view=diff
> ==============================================================================
> --- cfe/trunk/unittests/AST/ASTVectorTest.cpp (original)
> +++ cfe/trunk/unittests/AST/ASTVectorTest.cpp Tue Aug 26 09:17:25 2014
> @@ -72,7 +72,8 @@ TEST_F(ASTVectorTest, InsertEmpty) {
>    ASTVector<double> V;
>
>    // Ensure no pointer overflow when inserting empty range
> -  std::vector<int> IntVec{0, 1, 2, 3};
> +  int Values[] = { 0, 1, 2, 3 };
> +  std::vector<int> IntVec(Values, Values + 4);

We have array_lengthof to use, rather than the hardcoded 4. Or use an
ArrayRef instead of a std::vector, and it'll deduce the length
automatically (and still has begin/end that'll be fine for the
subsequent tests)

>    auto I = V.insert(Ctxt, V.begin(), IntVec.begin(), IntVec.begin());
>    ASSERT_EQ(V.begin(), I);
>    ASSERT_TRUE(V.empty());
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list