diff --git a/src/cmd/gc/lex.c b/src/cmd/gc/lex.c index 8cfa105ac3a..f356906e50d 100644 --- a/src/cmd/gc/lex.c +++ b/src/cmd/gc/lex.c @@ -537,8 +537,10 @@ l0: case '\'': /* '.' */ - if(escchar('\'', &escflag, &v)) - v = '\''; // allow ''' + if(escchar('\'', &escflag, &v)) { + yyerror("empty character literal or unescaped ' in character literal"); + v = '\''; + } if(!escchar('\'', &escflag, &v)) { yyerror("missing '"); ungetc(v); diff --git a/test/bugs/bug169.go b/test/fixedbugs/bug169.go similarity index 100% rename from test/bugs/bug169.go rename to test/fixedbugs/bug169.go diff --git a/test/golden.out b/test/golden.out index 90f21172cf1..6d70cb9e0d4 100644 --- a/test/golden.out +++ b/test/golden.out @@ -147,9 +147,6 @@ BUG: errchk: command succeeded unexpectedly 123 BUG: should fail -=========== bugs/bug169.go -BUG: errchk: command succeeded unexpectedly - =========== bugs/bug193.go BUG: errchk: bugs/bug193.go:14: missing expected error: 'shift'