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.
commit 6144eb78aeedee35570a29c90f5c58fb12b0987a
Author: Jason Merrill <ja...@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 "