Hi,

this 4.9 Regression is just and ICE on invalid, but I think it points to a (minor) matter or principle: the body of a constexpr constructor may have, possibly nested, BIND_EXPRs, but in any case there should be no BIND_EXPR_VARS (for this specific testcase the VAR_DECL has the TREE_TYPE == error mark_node, unsurprisingly)

Tested x86_64-linux.

Thanks,
Paolo.

///////////////////////
/cp
2013-10-18  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/58607
        * semantics.c (check_constexpr_ctor_body): Check for BIND_EXPR_VARS.

/testsuite
2013-10-18  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/58607
        * g++.dg/cpp0x/constexpr-ice9.C: New.
Index: cp/semantics.c
===================================================================
--- cp/semantics.c      (revision 203827)
+++ cp/semantics.c      (working copy)
@@ -7559,6 +7559,11 @@ check_constexpr_ctor_body (tree last, tree list)
            break;
          if (TREE_CODE (t) == BIND_EXPR)
            {
+             if (BIND_EXPR_VARS (t))
+               {
+                 ok = false;
+                 break;
+               }
              if (!check_constexpr_ctor_body (last, BIND_EXPR_BODY (t)))
                return false;
              else
Index: testsuite/g++.dg/cpp0x/constexpr-ice9.C
===================================================================
--- testsuite/g++.dg/cpp0x/constexpr-ice9.C     (revision 0)
+++ testsuite/g++.dg/cpp0x/constexpr-ice9.C     (working copy)
@@ -0,0 +1,7 @@
+// PR c++/58607
+// { dg-do compile { target c++11 } }
+
+struct A
+{
+  constexpr A() { i; }  // { dg-error "declared|empty body" }
+};

Reply via email to