Skip to content

Commit e0e1d79

Browse files
committed
clang: forbid labeled continue (#73)
1 parent f9adba6 commit e0e1d79

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

internal/clang/visit.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ func (g *Generator) emitBranchStmt(w io.Writer, stmt *ast.BranchStmt) {
111111
// Labeled break is translated to goto because C has no "break label".
112112
// ("break label" -> "goto label_end").
113113
fmt.Fprintf(w, "%sgoto %s_end;\n", g.indent(), stmt.Label.Name)
114+
} else if stmt.Label != nil && stmt.Tok == token.CONTINUE {
115+
g.fail(stmt, "labeled continue is not supported")
114116
} else if stmt.Label != nil {
115117
// Regular labeled goto, emit as-is.
116118
fmt.Fprintf(w, "%s%s %s;\n", g.indent(), stmt.Tok, stmt.Label.Name)

0 commit comments

Comments
 (0)