Patchwork C++ PATCH to avoid ICE on unimplemented constexpr bits

login
register
mail settings
Submitter Jason Merrill
Date April 22, 2013, 7:13 p.m.
Message ID <51758BC1.9060908@redhat.com>
Download mbox | patch
Permalink /patch/238641/
State New
Headers show

Comments

Jason Merrill - April 22, 2013, 7:13 p.m.
We still need to implement references to the object under construction 
in constexpr constructors; this will also be useful for implementing the 
support for aggregate initialization of classes with NSDMIs.  But until 
that happens, we shouldn't crash.

Tested x86_64-pc-linux-gnu, applying to trunk.

Patch

commit 6144eb78aeedee35570a29c90f5c58fb12b0987a
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Apr 16 21:10:36 2013 +0100

    	* semantics.c (potential_constant_expression_1): Don't crash on
    	'this' in NSDMI.

diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 391dc1e..2b8ceb2 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -8442,7 +8442,8 @@  potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags)
 		    tree x = get_nth_callarg (t, 0);
 		    if (is_this_parameter (x))
 		      {
-			if (DECL_CONSTRUCTOR_P (DECL_CONTEXT (x)))
+			if (DECL_CONTEXT (x) == NULL_TREE
+			    || DECL_CONSTRUCTOR_P (DECL_CONTEXT (x)))
 			  {
 			    if (flags & tf_error)
 			      sorry ("calling a member function of the "