[cfe-commits] r132661 - /cfe/trunk/test/SemaCXX/generalized-initializers.cpp

Johannes Schaub (litb) schaub.johannes at googlemail.com
Sun Jun 5 06:03:07 PDT 2011


Sebastian Redl wrote:

> Author: cornedbee
> Date: Sun Jun  5 07:23:08 2011
> New Revision: 132661
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=132661&view=rev
> Log:
> Expand on braced init list tests.
> 
...
>  namespace objects {
>  
> +  template <int N>
>    struct A {
> -    A();
> -    A(int, double);
> -    A(int, int);
> -    A(std::initializer_list<int>);
> -
> -    int operator[](A);
> +    A() { static_assert(N == 0, ""); }
> +    A(int, double) { static_assert(N == 1, ""); }
> +    A(int, int) { static_assert(N == 2, ""); }
> +    A(std::initializer_list<int>) { static_assert(N == 3, ""); }
>    };
>  
>    void initialization() {
...
> +    { A<0> a{}; }
> +    { A<0> a = {}; }
> +    { A<1> a{1, 1.0}; }
> +    { A<1> a = {1, 1.0}; }
> +    { A<3> a{1, 2, 3, 4, 5, 6, 7, 8}; }
> +    { A<3> a = {1, 2, 3, 4, 5, 6, 7, 8}; }
> +    { A<3> a{1, 2, 3, 4, 5, 6, 7, 8}; }
> +    { A<3> a{1, 2}; }

This looks incorrect to me. All constructs, except the first two (which does 
value-initialization and use the first constructor), use the last 
constructor (the initializer list constructor). 

>    }
>  





More information about the cfe-commits mailing list