Ping.

On Wed, Sep 25, 2013 at 01:08:38PM +0200, Marek Polacek wrote:
> The following testcase ICEd because complete_ctor_at_level_p got
> a union with two initializers - and didn't like that.  I think we can
> get away with splicing when sorting the initializers: we already gave
> an error and the program isn't accepted.
> 
> Regtested/bootstrapped on x86_64-linux, ok for trunk?
> 
> 2013-09-25  Marek Polacek  <pola...@redhat.com>
> 
>       PR c++/58510
> cp/
>       * init.c (sort_mem_initializers): Splice when giving an error.
> testsuite/
>       * g++.dg/cpp0x/pr58510.C: New test.
> 
> --- gcc/cp/init.c.mp  2013-09-25 11:50:18.246432664 +0200
> +++ gcc/cp/init.c     2013-09-25 11:50:18.262432728 +0200
> @@ -980,9 +980,12 @@ sort_mem_initializers (tree t, tree mem_
>             else if (TREE_VALUE (*last_p) && !TREE_VALUE (init))
>               goto splice;
>             else
> -             error_at (DECL_SOURCE_LOCATION (current_function_decl),
> -                       "initializations for multiple members of %qT",
> -                       ctx);
> +             {
> +               error_at (DECL_SOURCE_LOCATION (current_function_decl),
> +                         "initializations for multiple members of %qT",
> +                         ctx);
> +               goto splice;
> +             }
>           }
>  
>         last_p = p;
> --- gcc/testsuite/g++.dg/cpp0x/pr58510.C.mp   2013-09-25 12:19:02.612137551 
> +0200
> +++ gcc/testsuite/g++.dg/cpp0x/pr58510.C      2013-09-25 12:45:13.157119958 
> +0200
> @@ -0,0 +1,11 @@
> +// PR c++/58510
> +// { dg-do compile { target c++11 } }
> +
> +void foo()
> +{
> +  union
> +  {          // { dg-error "multiple" }
> +    int i = 0;
> +    char c = 0;
> +  };
> +}
> 
>       Marek

        Marek

Reply via email to