re PR c++/58607 ([c++11] ICE with undeclared variable in constexpr)
authorPaolo Carlini <paolo.carlini@oracle.com>
Mon, 25 Nov 2013 20:51:56 +0000 (20:51 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 25 Nov 2013 20:51:56 +0000 (20:51 +0000)
/cp
2013-11-25  Paolo Carlini  <paolo.carlini@oracle.com>

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

/testsuite
2013-11-25  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/58607
* g++.dg/cpp0x/constexpr-ice9.C: New.

From-SVN: r205364

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/constexpr-ice9.C [new file with mode: 0644]

index 8118471..e567aa0 100644 (file)
@@ -1,5 +1,10 @@
 2013-11-25  Paolo Carlini  <paolo.carlini@oracle.com>
 
+       PR c++/58607
+       * semantics.c (check_constexpr_ctor_body): Check for BIND_EXPR_VARS.
+
+2013-11-25  Paolo Carlini  <paolo.carlini@oracle.com>
+
        PR c++/58810
        * decl.c (grokdeclarator): Don't handle qualified free functions here,
        leave the diagnostic to grokfndecl.
index 316834c..d871c4d 100644 (file)
@@ -7596,6 +7596,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 50e72f4..920f826 100644 (file)
@@ -1,5 +1,10 @@
 2013-11-25  Paolo Carlini  <paolo.carlini@oracle.com>
 
+       PR c++/58607
+       * g++.dg/cpp0x/constexpr-ice9.C: New.
+
+2013-11-25  Paolo Carlini  <paolo.carlini@oracle.com>
+
        PR c++/58810
        * g++.dg/other/cv_func3.C: New.
        * g++.dg/other/cv_func.C: Adjust.
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ice9.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice9.C
new file mode 100644 (file)
index 0000000..50de372
--- /dev/null
@@ -0,0 +1,7 @@
+// PR c++/58607
+// { dg-do compile { target c++11 } }
+
+struct A
+{
+  constexpr A() { i; }  // { dg-error "declared|empty body" }
+};