From 0200ef59b599d10ba8e7fb880f06cce4dc256bc1 Mon Sep 17 00:00:00 2001 From: asutton Date: Fri, 22 May 2015 14:04:47 +0000 Subject: [PATCH] 2015-05-22 Andrew Sutton Fix regression caused by null de-reference. * gcc/cp/decl.c (xref_tag_1): Check that current_template_parms is non-null before accessing constraints. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/c++-concepts@223575 138bc75d-0d04-0410-961f-82ee72b054a4 --- ChangeLog.concepts | 6 ++++++ gcc/cp/decl.c | 12 ++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog.concepts b/ChangeLog.concepts index a4a1dd27c2b..a8ef4f74bb0 100644 --- a/ChangeLog.concepts +++ b/ChangeLog.concepts @@ -1,3 +1,9 @@ +2015-05-22 Andrew Sutton + + Fix regression caused by null de-reference. + * gcc/cp/decl.c (xref_tag_1): Check that current_template_parms + is non-null before accessing constraints. + 2015-05-19 Andrew Sutton Handle nested requirements with type errors. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 9cc1cf26b12..83c61da1d26 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -12592,10 +12592,14 @@ xref_tag_1 (enum tag_types tag_code, tree name, { if (template_header_p && MAYBE_CLASS_TYPE_P (t)) { - // Check that we aren't trying to overload a class with - // different constraints. - tree reqs = TEMPLATE_PARMS_CONSTRAINTS (current_template_parms); - tree constr = build_constraints (reqs, NULL_TREE); + /* Check that we aren't trying to overload a class with different + constraints. */ + tree constr = NULL_TREE; + if (current_template_parms) + { + tree reqs = TEMPLATE_PARMS_CONSTRAINTS (current_template_parms); + constr = build_constraints (reqs, NULL_TREE); + } if (!redeclare_class_template (t, current_template_parms, constr)) return error_mark_node; } -- 2.11.4.GIT