This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/45418] New: [C++0x] can't initialize array of non-trivial type with brace-init


Hello,

this may just not be implemented yet, but in case it was missed:

struct A1 {
};
struct A2 {
        A2(){}
};

template <class T> struct B {
        T tab[1];
        B(T const& t):tab({t}) {} // here
};

int main(){
        int i=2;
        B<int> b{i};
        A1 a1;
        B<A1> e1{a1};
        A2 a2;
        A2 c[1]{{a2}};
        B<A2> e2{a2}; // fails
}

complains about a "bad array initializer", whereas with a trivial type A1 or a
builtin int, it works fine.


-- 
           Summary: [C++0x] can't initialize array of non-trivial type with
                    brace-init
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: marc dot glisse at normalesup dot org
  GCC host triplet: x86_64-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45418


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]