diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6d4095c911b..5b0890627b7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2010-10-11 Martin Jambor + + PR c++/45562 + * cp-tree.h (current_class_ref): Check that cp_function_chain is + non-NULL. + * call.c (build_cxx_call): Likewise. + 2010-10-10 Jason Merrill * pt.c (tsubst_default_argument): Handle DEFAULT_ARG. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index e0911ac45d3..d3231913312 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -6082,7 +6082,8 @@ build_cxx_call (tree fn, int nargs, tree *argarray) fndecl = get_callee_fndecl (fn); if ((!fndecl || !TREE_NOTHROW (fndecl)) && at_function_scope_p () - && cfun) + && cfun + && cp_function_chain) cp_function_chain->can_throw = 1; /* Check that arguments to builtin functions match the expectations. */ diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index e4f24126dca..bfc6fd3d27b 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -1055,7 +1055,8 @@ struct GTY(()) language_function { (cfun && cp_function_chain \ ? cp_function_chain->x_current_class_ptr : NULL_TREE) #define current_class_ref \ - (cfun ? cp_function_chain->x_current_class_ref : NULL_TREE) + ((cfun && cp_function_chain) \ + ? cp_function_chain->x_current_class_ref : NULL_TREE) /* The EH_SPEC_BLOCK for the exception-specifiers for the current function, if any. */