Commit 70ec16f7 by Andrew Pinski Committed by Andrew Pinski

re PR c++/30221 (internal compiler error: in reshape_init_r, at cp/decl.c:4632)

2007-04-28  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR C++/30221
        * decl.c (reshape_init_r): Don't reshape the first element if it
        is a pointer to member function.

2007-04-28  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR C++/30221
        * g++.dg/init/ptrfn2.C: New test.
        * g++.dg/init/ptrfn3.C: New test.

From-SVN: r124271
parent 4f06d65b
2007-04-28 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR C++/30221
* decl.c (reshape_init_r): Don't reshape the first element if it
is a pointer to member function.
2007-04-27 Simon Baldwin <simonb@google.com> 2007-04-27 Simon Baldwin <simonb@google.com>
* decl.c (grokparms): Changed message format from %qD to %qE. * decl.c (grokparms): Changed message format from %qD to %qE.
......
...@@ -4638,19 +4638,24 @@ reshape_init_r (tree type, reshape_iter *d, bool first_initializer_p) ...@@ -4638,19 +4638,24 @@ reshape_init_r (tree type, reshape_iter *d, bool first_initializer_p)
{ {
if (TREE_CODE (init) == CONSTRUCTOR) if (TREE_CODE (init) == CONSTRUCTOR)
{ {
if (TREE_TYPE (init) && TYPE_PTRMEMFUNC_P (TREE_TYPE (init)))
/* There is no need to reshape pointer-to-member function
initializers, as they are always constructed correctly
by the front end. */
;
else if (COMPOUND_LITERAL_P (init))
/* For a nested compound literal, there is no need to reshape since /* For a nested compound literal, there is no need to reshape since
brace elision is not allowed. Even if we decided to allow it, brace elision is not allowed. Even if we decided to allow it,
we should add a call to reshape_init in finish_compound_literal, we should add a call to reshape_init in finish_compound_literal,
before calling digest_init, so changing this code would still before calling digest_init, so changing this code would still
not be necessary. */ not be necessary. */
if (!COMPOUND_LITERAL_P (init)) gcc_assert (!BRACE_ENCLOSED_INITIALIZER_P (init));
else
{ {
++d->cur; ++d->cur;
gcc_assert (BRACE_ENCLOSED_INITIALIZER_P (init)); gcc_assert (BRACE_ENCLOSED_INITIALIZER_P (init));
return reshape_init (type, init); return reshape_init (type, init);
} }
else
gcc_assert (!BRACE_ENCLOSED_INITIALIZER_P (init));
} }
warning (OPT_Wmissing_braces, "missing braces around initializer for %qT", warning (OPT_Wmissing_braces, "missing braces around initializer for %qT",
......
2007-04-28 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR C++/30221
* g++.dg/init/ptrfn2.C: New test.
* g++.dg/init/ptrfn3.C: New test.
2007-04-29 Paul Thomas <pault@gcc.gnu.org> 2007-04-29 Paul Thomas <pault@gcc.gnu.org>
PR fortran/31711 PR fortran/31711
// { dg-options "" }
// { dg-do compile }
// C++/30221
// We would ICE while trying to reshape the pointer to
// member function element which is not needed.
class abstract {};
typedef void (abstract::*fptr1) (short & s ) const;
struct s {};
s array[] =
{
(fptr1)0
};// { dg-error "" }
// { dg-options "" }
// { dg-do compile }
// C++/30221
// We would ICE while trying to reshape the pointer to
// member function element which is not needed.
class abstract {};
typedef void (abstract::*fptr1) (short & s ) const;
struct s {fptr1 f;};
s array[] =
{
(fptr1)0
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment