diff mbox

[C++] PR 58565

Message ID 524BE999.9000704@oracle.com
State New
Headers show

Commit Message

Paolo Carlini Oct. 2, 2013, 9:38 a.m. UTC
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.carlini@oracle.com>

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

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

	PR c++/58565
	* g++.dg/parse/crash64.C: New.

Comments

Jason Merrill Oct. 2, 2013, 10:08 a.m. UTC | #1
OK.

Jason
diff mbox

Patch

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" }
+}