Hi,

here, with -std=c++11 LABEL_EXPR is unhandled by potential_constant_expression_1 and we can't emit a meaningful diagnostic. It seems safe to just add it to the main switch, together with the existing LABEL_DECL.

Tested x86_64-linux.

Thanks,
Paolo.

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

        PR c++/58565
        * semantics.c (potential_constant_expression_1): Handle LABEL_EXPR.

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

        PR c++/58565
        * g++.dg/parse/crash64.C: New.
Index: cp/semantics.c
===================================================================
--- cp/semantics.c      (revision 203101)
+++ cp/semantics.c      (working copy)
@@ -8422,6 +8422,7 @@ potential_constant_expression_1 (tree t, bool want
     case OVERLOAD:
     case TEMPLATE_ID_EXPR:
     case LABEL_DECL:
+    case LABEL_EXPR:
     case CONST_DECL:
     case SIZEOF_EXPR:
     case ALIGNOF_EXPR:
Index: testsuite/g++.dg/parse/crash64.C
===================================================================
--- testsuite/g++.dg/parse/crash64.C    (revision 0)
+++ testsuite/g++.dg/parse/crash64.C    (working copy)
@@ -0,0 +1,7 @@
+// PR c++/58565
+// { dg-options "" }
+
+void foo()
+{
+  int i = ({ L: ; });  // { dg-error "void value not ignored" }
+}

Reply via email to