This is the mail archive of the gcc-patches@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]

Re: [PATCH] Fix PR C++/30221: ICE in reshape_init_r with pointer to member functions


Andrew_Pinski@PlayStation.Sony.Com wrote:

>         * decl.c (reshape_init_r): Don't reshape the first element if it 
> is a pointer to member function.
> 
>         * g++.dg/init/ptrfn2.C: New test.
>         * g++.dg/init/ptrfn3.C: New test.

Why does reshaping the pointer-to-member cause a crash?  If the
initializer is already being created correctly, won't the reshaping do
nothing?

Stylistically, I'd prefer your change as:

     if (TREE_CODE (init) == CONSTRUCTOR
         /* For a pointer-to-member function, the initializer is
            already correct, and we must not try to reshape it
            because ...  */
         && (!TREE_TYPE (init)
             || !TYPE_PTRMEMFUNC_P (TREE_TYPE (init))))

Please explain a little more about what's going on.

Thanks,

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


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