Commit 842dc2e6 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/70869 (internal compiler error: Segmentation fault on array of pointer…

re PR c++/70869 (internal compiler error: Segmentation fault on array of pointer to function members)

	PR c++/70869
	PR c++/71054
	* cp-gimplify.c (cp_genericize_r): For DECL_EXPR for non-static
	artificial vars, genericize their initializers.

	* g++.dg/cpp0x/pr70869.C: New test.
	* g++.dg/cpp0x/pr71054.C: New test.

Co-Authored-By: Kai Tietz <ktietz70@googlemail.com>

From-SVN: r238124
parent 31be4262
2016-07-07 Jakub Jelinek <jakub@redhat.com>
Kai Tietz <ktietz70@googlemail.com>
PR c++/70869
PR c++/71054
* cp-gimplify.c (cp_genericize_r): For DECL_EXPR for non-static
artificial vars, genericize their initializers.
2016-07-05 David Malcolm <dmalcolm@redhat.com>
PR c++/62314
......
......@@ -1304,7 +1304,15 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data)
{
tree d = DECL_EXPR_DECL (stmt);
if (TREE_CODE (d) == VAR_DECL)
gcc_assert (CP_DECL_THREAD_LOCAL_P (d) == DECL_THREAD_LOCAL_P (d));
{
gcc_assert (CP_DECL_THREAD_LOCAL_P (d) == DECL_THREAD_LOCAL_P (d));
/* User var initializers should be genericized during containing
BIND_EXPR genericization when walk_tree walks DECL_INITIAL
of BIND_EXPR_VARS. Artificial temporaries might not be
mentioned there though, so walk them now. */
if (DECL_ARTIFICIAL (d) && !TREE_STATIC (d) && DECL_INITIAL (d))
cp_walk_tree (&DECL_INITIAL (d), cp_genericize_r, data, NULL);
}
}
else if (TREE_CODE (stmt) == OMP_PARALLEL
|| TREE_CODE (stmt) == OMP_TASK
......
2016-07-07 Jakub Jelinek <jakub@redhat.com>
Kai Tietz <ktietz70@googlemail.com>
PR c++/70869
PR c++/71054
* g++.dg/cpp0x/pr70869.C: New test.
* g++.dg/cpp0x/pr71054.C: New test.
2016-07-07 David Edelsohn <dje.gcc@gmail.com>
* g++.dg/debug/pr71432.C: Fail on AIX.
......
// PR c++/70869
// { dg-do run { target c++11 } }
#include <initializer_list>
struct A
{
int f () { return 1; }
int g () { return 2; }
int h () { return 3; }
};
int
main ()
{
int cnt = 0;
for (const auto &m : { &A::f, &A::g, &A::h })
{
A a;
if ((a.*m) () != ++cnt)
__builtin_abort ();
}
if (cnt != 3)
__builtin_abort ();
}
// PR c++/71054
// { dg-do compile { target c++11 } }
#include <initializer_list>
template <typename D, typename T = decltype (&D::U)>
struct S
{
struct A
{
int a;
int b;
T p;
};
S () { std::initializer_list<A> a{ {0, 0, &D::V} }; }
};
struct R {
void V (int);
void U (int);
};
S<R> b;
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