semantics.c (potential_constant_expression_1): Don't crash on 'this' in NSDMI.
authorJason Merrill <jason@redhat.com>
Mon, 22 Apr 2013 19:13:19 +0000 (15:13 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 22 Apr 2013 19:13:19 +0000 (15:13 -0400)
* semantics.c (potential_constant_expression_1): Don't crash on
'this' in NSDMI.

From-SVN: r198154

gcc/cp/ChangeLog
gcc/cp/semantics.c

index b8c4727..dffab2c 100644 (file)
@@ -1,5 +1,8 @@
 2013-04-22  Jason Merrill  <jason@redhat.com>
 
+       * semantics.c (potential_constant_expression_1): Don't crash on
+       'this' in NSDMI.
+
        Core 1612
        * semantics.c (finish_id_expression): Reject capture of anonymous
        union member.
index 391dc1e..2b8ceb2 100644 (file)
@@ -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 "